plug-ins/FractalExplorer plug-ins/Lighting plug-ins/bmp plug-ins/dbbrowser

2005-03-04  Sven Neumann  <sven@gimp.org>

	* plug-ins/FractalExplorer
	* plug-ins/Lighting
	* plug-ins/bmp
	* plug-ins/dbbrowser
	* plug-ins/faxg3
	* plug-ins/fits
	* plug-ins/flame
	* plug-ins/gfig
	* plug-ins/gflare
	* plug-ins/gfli
	* plug-ins/gimpressionist
	* plug-ins/ifscompose
	* plug-ins/jpeg
	* plug-ins/maze
	* plug-ins/pagecurl
	* plug-ins/print
	* plug-ins/rcm
	* plug-ins/script-fu
	* plug-ins/sel2path
	* plug-ins/sgi
	* plug-ins/twain
	* plug-ins/winicon
	* plug-ins/xjt: ported to gstdio, removed unnecessary includes,
	minor fixes to filename handling here and there.
This commit is contained in:
Sven Neumann 2005-03-04 13:23:32 +00:00 committed by Sven Neumann
parent a303b44c62
commit f48efa965c
71 changed files with 4226 additions and 4302 deletions

View File

@ -1,10 +1,30 @@
/**********************************************************************
The GIMP -- an image manipulation program
Copyright (C) 1995 Spencer Kimball and Peter Mattis
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*********************************************************************/
#include "config.h"
#include <errno.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <glib/gstdio.h>
#include <libgimp/gimp.h>
#include <libgimp/gimpui.h>
@ -1790,12 +1810,10 @@ save_options (FILE * fp)
static void
save_callback (void)
{
FILE *fp;
gchar *savename;
FILE *fp;
const gchar *savename = filename;
savename = filename;
fp = fopen (savename, "wt+");
fp = g_fopen (savename, "wt+");
if (!fp)
{
@ -2093,7 +2111,8 @@ explorer_load (void)
gchar load_buf[MAX_LOAD_LINE];
g_assert (filename != NULL);
fp = fopen (filename, "rt");
fp = g_fopen (filename, "rt");
if (!fp)
{

View File

@ -51,13 +51,16 @@
#include "config.h"
#include <stdio.h>
#include <errno.h>
#include <stdlib.h>
#include <string.h>
#ifdef HAVE_UNISTD_H
#include <unistd.h>
#endif
#include <glib/gstdio.h>
#ifdef __GNUC__
#warning GTK_DISABLE_DEPRECATED
#endif
@ -1132,9 +1135,8 @@ fractalexplorer_free_everything (fractalexplorerOBJ *fractalexplorer)
g_assert (fractalexplorer != NULL);
if (fractalexplorer->filename)
{
remove (fractalexplorer->filename);
}
g_remove (fractalexplorer->filename);
fractalexplorer_free (fractalexplorer);
}
@ -1155,10 +1157,12 @@ fractalexplorer_load (const gchar *filename,
gchar load_buf[MAX_LOAD_LINE];
g_assert (filename != NULL);
fp = fopen (filename, "rt");
fp = g_fopen (filename, "rt");
if (!fp)
{
g_warning ("Error opening: %s", filename);
g_message (_("Could not open '%s' for reading: %s"),
gimp_filename_to_utf8 (filename), g_strerror (errno));
return NULL;
}
@ -1212,7 +1216,7 @@ fractalexplorer_list_load_one (const GimpDatafileData *file_data,
if (fractalexplorer)
{
/* Read only ?*/
/* Read only ?*/ /* FIXME: filename handling for Win32 */
if (access (filename, W_OK))
fractalexplorer->obj_status |= fractalexplorer_READONLY;

View File

@ -19,10 +19,11 @@
#include "config.h"
#include <stdio.h>
#include <string.h>
#include <errno.h>
#include <glib/gstdio.h>
#include <libgimp/gimp.h>
#include <libgimp/gimpui.h>
@ -72,14 +73,14 @@ static void envmap_combo_callback (GtkWidget *widget,
gpointer data);
static void save_lighting_preset (GtkWidget *widget,
gpointer data);
static void file_chooser_response (GtkFileChooser *chooser,
static void save_preset_response (GtkFileChooser *chooser,
gint response_id,
gpointer data);
static void load_lighting_preset (GtkWidget *widget,
gpointer data);
static void load_file_chooser_response (GtkFileChooser *chooser,
gint response_id,
gpointer data);
static void load_preset_response (GtkFileChooser *chooser,
gint response_id,
gpointer data);
static void lightselect_callback (GimpIntComboBox *combo,
gpointer data);
static void apply_settings (GtkWidget *widget,
@ -1088,7 +1089,7 @@ save_lighting_preset (GtkWidget *widget,
G_CALLBACK (gtk_widget_destroyed),
&window);
g_signal_connect (window, "response",
G_CALLBACK (file_chooser_response),
G_CALLBACK (save_preset_response),
NULL);
}
@ -1119,9 +1120,9 @@ save_lighting_preset (GtkWidget *widget,
static void
file_chooser_response (GtkFileChooser *chooser,
gint response_id,
gpointer data)
save_preset_response (GtkFileChooser *chooser,
gint response_id,
gpointer data)
{
FILE *fp;
gint num_lights = 0;
@ -1136,7 +1137,7 @@ file_chooser_response (GtkFileChooser *chooser,
{
gchar *filename = gtk_file_chooser_get_filename (chooser);
fp = fopen (filename, "w");
fp = g_fopen (filename, "w");
if (!fp)
{
@ -1194,6 +1195,8 @@ file_chooser_response (GtkFileChooser *chooser,
fclose (fp);
}
g_free (filename);
}
gtk_widget_destroy (GTK_WIDGET (chooser));
@ -1223,7 +1226,7 @@ load_lighting_preset (GtkWidget *widget,
G_CALLBACK (gtk_widget_destroyed),
&window);
g_signal_connect (window, "response",
G_CALLBACK (load_file_chooser_response),
G_CALLBACK (load_preset_response),
NULL);
}
@ -1255,9 +1258,9 @@ load_lighting_preset (GtkWidget *widget,
static void
load_file_chooser_response (GtkFileChooser *chooser,
gint response_id,
gpointer data)
load_preset_response (GtkFileChooser *chooser,
gint response_id,
gpointer data)
{
FILE *fp;
gint num_lights;
@ -1269,12 +1272,11 @@ load_file_chooser_response (GtkFileChooser *chooser,
gchar type_label[20];
gchar *endptr;
if (response_id == GTK_RESPONSE_OK)
{
gchar *filename = gtk_file_chooser_get_filename (chooser);
fp = fopen (filename, "r");
fp = g_fopen (filename, "r");
if (!fp)
{
@ -1332,6 +1334,8 @@ load_file_chooser_response (GtkFileChooser *chooser,
fclose (fp);
}
g_free (filename);
lightselect_callback (GIMP_INT_COMBO_BOX (lightselect_combo), NULL);
}

View File

@ -50,7 +50,6 @@
#include "config.h"
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
@ -63,6 +62,7 @@
#include "libgimp/stdplugins-intl.h"
const gchar *filename = NULL;
gboolean interactive_bmp;

View File

@ -24,10 +24,10 @@
#include "config.h"
#include <errno.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <glib/gstdio.h>
#include <gtk/gtk.h>
#include <libgimp/gimp.h>
@ -126,7 +126,8 @@ ReadChannelMasks (FILE *fd, Bitmap_Channel *masks, guint channels)
masks[i].shiftin = offset;
masks[i].shiftout = 8 - nbits;
#ifdef DEBUG
g_print ("Channel %d mask %08x in %d out %d\n", i, masks[i].mask, masks[i].shiftin, masks[i].shiftout);
g_print ("Channel %d mask %08x in %d out %d\n",
i, masks[i].mask, masks[i].shiftin, masks[i].shiftout);
#endif
}
return TRUE;
@ -145,7 +146,7 @@ ReadBMP (const gchar *name)
Bitmap_Channel *masks;
filename = name;
fd = fopen (filename, "rb");
fd = g_fopen (filename, "rb");
if (!fd)
{
@ -160,17 +161,17 @@ ReadBMP (const gchar *name)
/* It is a File. Now is it a Bitmap? Read the shortest possible header */
if (!ReadOK (fd, magick, 2) || !(!strncmp (magick,"BA",2) ||
!strncmp (magick,"BM",2) || !strncmp (magick,"IC",2) ||
!strncmp (magick,"PI",2) || !strncmp (magick,"CI",2) ||
!strncmp (magick,"CP",2)))
if (!ReadOK (fd, magick, 2) || !(!strncmp (magick, "BA", 2) ||
!strncmp (magick, "BM", 2) || !strncmp (magick, "IC", 2) ||
!strncmp (magick, "PI", 2) || !strncmp (magick, "CI", 2) ||
!strncmp (magick, "CP", 2)))
{
g_message (_("'%s' is not a valid BMP file"),
gimp_filename_to_utf8 (filename));
return -1;
}
while (!strncmp(magick,"BA",2))
while (!strncmp (magick, "BA", 2))
{
if (!ReadOK (fd, buffer, 12))
{

View File

@ -30,12 +30,9 @@
#include "config.h"
#include <errno.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#ifdef HAVE_UNISTD_H
#include <unistd.h>
#endif
#include <glib/gstdio.h>
#include <gtk/gtk.h>
@ -192,7 +189,7 @@ WriteBMP (const gchar *filename,
}
/* Let's take some file */
outfile = fopen (filename, "wb");
outfile = g_fopen (filename, "wb");
if (!outfile)
{
g_message (_("Could not open '%s' for writing: %s"),

View File

@ -23,8 +23,6 @@
#include "config.h"
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <time.h>

View File

@ -41,9 +41,6 @@
#include "config.h"
#include <stdlib.h>
#include <stdio.h>
#include <gtk/gtk.h>
#include <libgimp/gimp.h>

View File

@ -23,8 +23,6 @@
#include "config.h"
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <time.h>

View File

@ -41,9 +41,6 @@
#include "config.h"
#include <stdlib.h>
#include <stdio.h>
#include <gtk/gtk.h>
#include <libgimp/gimp.h>

View File

@ -20,18 +20,19 @@
*/
#include "config.h"
#include <glib.h> /* For G_OS_WIN32 */
#include <errno.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#ifdef HAVE_UNISTD_H
#include <unistd.h>
#endif
#include <sys/types.h>
#include <string.h>
#include <fcntl.h>
#include <glib.h> /* For G_OS_WIN32 */
#include <glib/gstdio.h>
#ifdef G_OS_WIN32
#include <io.h>
#endif
@ -211,7 +212,7 @@ load_image (const gchar *filename)
init_byte_tab( 0, byte_tab );
fd = open (filename, O_RDONLY | _O_BINARY);
fd = g_open (filename, O_RDONLY | _O_BINARY);
if (fd < 0)
{
@ -232,7 +233,7 @@ load_image (const gchar *filename)
lseek(fd, 0L, 0);
rs = read( fd, rbuf, sizeof(rbuf) );
if ( rs < 0 ) { perror( "read" ); close( rs ); exit(8); }
if ( rs < 0 ) { perror( "read" ); close( rs ); gimp_quit (); }
rr += rs;
gimp_progress_update ((float)rr/rsize/2.0);
@ -250,7 +251,7 @@ load_image (const gchar *filename)
while ( rs > 0 && cons_eol < 4 ) /* i.e., while (!EOF) */
{
#ifdef DEBUG
fprintf( stderr, "hibit=%2d, data=", hibit );
g_printerr ("hibit=%2d, data=", hibit );
putbin( data );
#endif
while ( hibit < 20 )
@ -268,7 +269,7 @@ load_image (const gchar *filename)
if ( rs == 0 ) { goto do_write; }
}
#ifdef DEBUG
fprintf( stderr, "hibit=%2d, data=", hibit );
g_printerr ("hibit=%2d, data=", hibit );
putbin( data );
#endif
}
@ -287,7 +288,7 @@ load_image (const gchar *filename)
if ( p == NULL ) /* invalid code */
{
fprintf( stderr, "invalid code, row=%d, col=%d, file offset=%lx, skip to eol\n",
g_printerr ("invalid code, row=%d, col=%d, file offset=%lx, skip to eol\n",
row, col, (unsigned long) lseek( fd, 0, 1 ) - rs + rp );
while ( ( data & 0x03f ) != 0 )
{
@ -316,7 +317,7 @@ load_image (const gchar *filename)
nr_pels = ( (struct g3_leaf *) p ) ->nr_pels;
#ifdef DEBUG
fprintf( stderr, "PELs: %d (%c)\n", nr_pels, '0'+color );
g_printerr ("PELs: %d (%c)\n", nr_pels, '0'+color );
#endif
}
@ -324,7 +325,7 @@ load_image (const gchar *filename)
if ( nr_pels == -1 )
{
#ifdef DEBUG
fprintf( stderr, "hibit=%2d, data=", hibit );
g_printerr ("hibit=%2d, data=", hibit );
putbin( data );
#endif
/* skip filler 0bits -> seek for "1"-bit */
@ -354,7 +355,7 @@ load_image (const gchar *filename)
}
}
#ifdef DEBUG
fprintf( stderr, "hibit=%2d, data=", hibit );
g_printerr ("hibit=%2d, data=", hibit );
putbin( data );
#endif
} /* end skip 0bits */
@ -371,21 +372,21 @@ load_image (const gchar *filename)
/* bitmap memory full? make it larger! */
if ( row >= max_rows )
{
char * p = (char *) realloc( bitmap,
( max_rows += 500 ) * MAX_COLS/8 );
{
gchar *p = g_try_realloc( bitmap,
( max_rows += 500 ) * MAX_COLS/8 );
if ( p == NULL )
{
{
perror( "realloc() failed, page truncated" );
rs = 0;
}
}
else
{
{
bitmap = p;
memset( &bitmap[ row * MAX_COLS/8 ], 0,
( max_rows - row ) * MAX_COLS/8 );
}
}
}
}
col=0; bp = &bitmap[ row * MAX_COLS/8 ];
cons_eol = 0;
@ -418,7 +419,7 @@ do_write: /* write pbm (or whatever) file */
if( fd != 0 ) close(fd); /* close input file */
#ifdef DEBUG
fprintf( stderr, "consecutive EOLs: %d, max columns: %d\n", cons_eol, hcol );
g_printerr ("consecutive EOLs: %d, max columns: %d\n", cons_eol, hcol );
#endif
image_id = emitgimp (hcol, row, bitmap, bperrow, filename);
@ -454,7 +455,7 @@ emitgimp (gint hcol,
tmp = 0;
#ifdef DEBUG
fprintf( stderr, "emit gimp: %d x %d\n", hcol, row);
g_printerr ("emit gimp: %d x %d\n", hcol, row);
#endif
image_ID = gimp_image_new (hcol, row, GIMP_GRAY);
@ -471,7 +472,7 @@ emitgimp (gint hcol,
0, 0, drawable->width, drawable->height, TRUE, FALSE);
tile_height = gimp_tile_height ();
#ifdef DEBUG
fprintf( stderr, "tile height: %d\n", tile_height);
g_printerr ("tile height: %d\n", tile_height);
#endif
buf = g_new (guchar, hcol*tile_height);
@ -484,7 +485,7 @@ emitgimp (gint hcol,
}
if ((y-yy) == tile_height-1) {
#ifdef DEBUG
fprintf( stderr, "update tile height: %d\n", tile_height);
g_printerr ("update tile height: %d\n", tile_height);
#endif
gimp_pixel_rgn_set_rect (&pixel_rgn, buf, 0, yy, hcol, tile_height);
gimp_progress_update (0.5+(float)y/row/2.0);
@ -494,7 +495,7 @@ emitgimp (gint hcol,
}
if (row-yy) {
#ifdef DEBUG
fprintf( stderr, "update rest: %d\n", row-yy);
g_printerr ("update rest: %d\n", row-yy);
#endif
gimp_pixel_rgn_set_rect (&pixel_rgn, buf, 0, yy, hcol, row-yy);
}

View File

@ -2,13 +2,10 @@
#include "config.h"
#include <stdio.h>
#include <stdlib.h>
#ifdef HAVE_UNISTD_H
#include <unistd.h>
#endif
#include <sys/types.h>
#include <string.h>
#include <stdio.h>
#include <glib.h>
#include "g3.h"
@ -244,7 +241,7 @@ int i;
}
if ( p2->nr_bits != 0 )
{
fprintf( stderr, "internal table setup error\n" ); exit(6);
g_printerr ("internal table setup error\n" ); exit(6);
}
tree_add_node( p2, g3c, bit_code >> FBITS, bit_length - FBITS );
}

View File

@ -32,16 +32,12 @@
* (moved it from load to save)
*/
static char ident[] = "@(#) GIMP FITS file-plugin v1.06 21-Nov-99";
#include "config.h"
#include <errno.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <errno.h>
#include <gtk/gtk.h>
#include <glib/gstdio.h>
#include <libgimp/gimp.h>
#include <libgimp/gimpui.h>
@ -331,7 +327,7 @@ load_image (const gchar *filename)
FITS_FILE *ifp;
FITS_HDU_LIST *hdu;
fp = fopen (filename, "rb");
fp = g_fopen (filename, "rb");
if (!fp)
{
g_message (_("Could not open '%s' for reading: %s"),
@ -420,7 +416,6 @@ save_image (const gchar *filename,
FITS_FILE* ofp;
GimpImageType drawable_type;
gint retval;
char *temp = ident; /* Just to satisfy lint/gcc */
drawable_type = gimp_drawable_type (drawable_ID);
@ -452,10 +447,9 @@ save_image (const gchar *filename,
return (FALSE);
}
temp = g_strdup_printf (_("Saving '%s'..."),
gimp_progress_init (NULL);
gimp_progress_set_text (_("Saving '%s'..."),
gimp_filename_to_utf8 (filename));
gimp_progress_init (temp);
g_free (temp);
if ((drawable_type == GIMP_INDEXED_IMAGE) ||
(drawable_type == GIMP_INDEXEDA_IMAGE))
@ -986,7 +980,7 @@ load_dialog (void)
TRUE, TRUE, 0);
gtk_widget_show (vbox);
frame = gimp_int_radio_group_new (TRUE, _("BLANK/NaN Pixel Replacement"),
frame = gimp_int_radio_group_new (TRUE, _("Replacement for undefined pixels"),
G_CALLBACK (gimp_radio_button_update),
&plvals.replace, plvals.replace,

View File

@ -56,8 +56,6 @@
/******************************************************************************/
#define VERSIO 0.11
/* Identifikation: "@(#) <product> <ver> <dd-mmm-yy>" */
static char ident[] = "@(#) libfits.c 0.11 20-Dec-97 (%I%)";
/******************************************************************************/
/* FITS reading/writing library */
@ -86,12 +84,10 @@ static char ident[] = "@(#) libfits.c 0.11 20-Dec-97 (%I%)";
#include "config.h"
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#ifdef HAVE_UNISTD_H
#include <unistd.h>
#endif
#include <glib/gstdio.h>
#include "fitsrw.h"
@ -350,7 +346,7 @@ static int fits_nan_32 (unsigned char *v)
return ( ((k >= 0x7f7fffff) && (k <= 0x7fffffff))
|| ((k >= 0x00000001) && (k <= 0x00800000)));
}
/*****************************************************************************/
/* #BEG-PAR */
@ -519,7 +515,7 @@ FITS_FILE *fits_open (const char *filename, const char *openmode)
if ((!reading) && (!writing))
FITS_RETURN ("fits_open: Invalid openmode", NULL);
fp = fopen (filename, reading ? "rb" : "wb");
fp = g_fopen (filename, reading ? "rb" : "wb");
if (fp == NULL) FITS_RETURN ("fits_open: fopen() failed", NULL);
ff = fits_new_filestruct ();
@ -560,7 +556,7 @@ FITS_FILE *fits_open (const char *filename, const char *openmode)
if (hdulist->used.blank_value) ff->blank_used = 1;
if (hdulist->used.nan_value) ff->nan_used = 1;
if (n_hdr == 0)
if (n_hdr == 0)
ff->hdu_list = hdulist;
else
last_hdulist->next_hdu = hdulist;
@ -572,7 +568,7 @@ FITS_FILE *fits_open (const char *filename, const char *openmode)
if (fseek (fp, hdulist->data_offset+hdulist->data_size, SEEK_SET) < 0)
break;
}
return (ff);
}
@ -956,7 +952,7 @@ int fits_write_header (FITS_FILE *ff, FITS_HDU_LIST *hdulist)
/* */
/* #END-PAR */
/*****************************************************************************/
static FITS_HDU_LIST *fits_decode_header (FITS_RECORD_LIST *hdr,
long hdr_offset, long dat_offset)
@ -1101,7 +1097,7 @@ static FITS_HDU_LIST *fits_decode_header (FITS_RECORD_LIST *hdr,
|| ( (hdulist->bitpix == -32)
&& ( fits_ieee32_intel || fits_ieee32_motorola
|| fits_ieee64_intel || fits_ieee64_motorola));
if (bitpix_supported)
{
if (hdulist->used.simple)
@ -1165,11 +1161,11 @@ err_return:
static int fits_eval_pixrange (FILE *fp, FITS_HDU_LIST *hdu)
{register int maxelem;
#define FITSNPIX 4096
#define FITSNPIX 4096
unsigned char pixdat[FITSNPIX];
int nelem, bpp;
int blank_found = 0, nan_found = 0;
if (fseek (fp, hdu->data_offset, SEEK_SET) < 0)
FITS_RETURN ("fits_eval_pixrange: cant position file", -1);
@ -1191,7 +1187,7 @@ static int fits_eval_pixrange (FILE *fp, FITS_HDU_LIST *hdu)
nelem -= maxelem;
if (fread ((char *)pixdat, bpp, maxelem, fp) != maxelem)
FITS_RETURN ("fits_eval_pixrange: error on read bitpix 8 data", -1);
ptr = pixdat;
if (hdu->used.blank)
{
@ -1233,7 +1229,7 @@ static int fits_eval_pixrange (FILE *fp, FITS_HDU_LIST *hdu)
nelem -= maxelem;
if (fread ((char *)pixdat, bpp, maxelem, fp) != maxelem)
FITS_RETURN ("fits_eval_pixrange: error on read bitpix 16 data", -1);
ptr = pixdat;
if (hdu->used.blank)
{FITS_BITPIX16 blankval = (FITS_BITPIX16)hdu->blank;
@ -1278,7 +1274,7 @@ static int fits_eval_pixrange (FILE *fp, FITS_HDU_LIST *hdu)
nelem -= maxelem;
if (fread ((char *)pixdat, bpp, maxelem, fp) != maxelem)
FITS_RETURN ("fits_eval_pixrange: error on read bitpix 32 data", -1);
ptr = pixdat;
if (hdu->used.blank)
{FITS_BITPIX32 blankval = (FITS_BITPIX32)hdu->blank;
@ -1329,7 +1325,7 @@ static int fits_eval_pixrange (FILE *fp, FITS_HDU_LIST *hdu)
nelem -= maxelem;
if (fread ((char *)pixdat, bpp, maxelem, fp) != maxelem)
FITS_RETURN ("fits_eval_pixrange: error on read bitpix -32 data", -1);
ptr = pixdat;
while (maxelem-- > 0)
{
@ -1370,7 +1366,7 @@ static int fits_eval_pixrange (FILE *fp, FITS_HDU_LIST *hdu)
nelem -= maxelem;
if (fread ((char *)pixdat, bpp, maxelem, fp) != maxelem)
FITS_RETURN ("fits_eval_pixrange: error on read bitpix -64 data", -1);
ptr = pixdat;
while (maxelem-- > 0)
{
@ -1425,7 +1421,7 @@ FITS_DATA *fits_decode_card (const char *card, FITS_DATA_TYPES data_type)
long l_long;
double l_double;
char l_card[FITS_CARD_SIZE+1], msg[256];
char *cp = ident, *dst, *end;
char *cp, *dst, *end;
if (card == NULL) return (NULL);
@ -1468,7 +1464,7 @@ FITS_DATA *fits_decode_card (const char *card, FITS_DATA_TYPES data_type)
FITS_RETURN ("fits_decode_card: error decoding typ_bitpixm64", NULL);
data.bitpixm64 = (FITS_BITPIXM64)l_double;
break;
case typ_fbool:
cp = l_card+10;
while (*cp == ' ') cp++;
@ -1596,7 +1592,7 @@ FITS_HDU_LIST *fits_image_info (FITS_FILE *ff, int picind, int *hdupicind)
if (ff->openmode != 'r')
FITS_RETURN ("fits_image_info: file not open for reading", NULL);
if ((picind < 1) || (picind > ff->n_pic))
FITS_RETURN ("fits_image_info: picind out of range", NULL);
@ -1692,7 +1688,7 @@ int fits_read_pixel (FITS_FILE *ff, FITS_HDU_LIST *hdulist, int npix,
FITS_BITPIXM64 bpm64;
/* initialize */
bpm32 = 0;
if (ff->openmode != 'r') return (-1); /* Not open for reading */
@ -1944,7 +1940,7 @@ int fits_to_pgmraw (char *fitsfile, char *pgmfile)
if (hdu == NULL) goto err_return;
if (hdu->naxis < 2) goto err_return; /* Enough dimensions ? */
pgmout = fopen (pgmfile, "wb");
pgmout = g_fopen (pgmfile, "wb");
if (pgmout == NULL) goto err_return;
/* Write PGM header with width/height */
@ -1978,7 +1974,7 @@ int fits_to_pgmraw (char *fitsfile, char *pgmfile)
retval = 0;
err_return:
if (fitsin) fits_close (fitsin);
if (pgmout) fclose (pgmout);
@ -2015,7 +2011,7 @@ int pgmraw_to_fits (char *pgmfile, char *fitsfile)
fitsout = fits_open (fitsfile, "w");
if (fitsout == NULL) goto err_return;
pgmin = fopen (pgmfile, "r");
pgmin = g_fopen (pgmfile, "r");
if (pgmin == NULL) goto err_return;
/* Read signature of PGM file */
@ -2037,7 +2033,7 @@ int pgmraw_to_fits (char *pgmfile, char *fitsfile)
if (fgets (buffer, sizeof (buffer), pgmin) == NULL) goto err_return;
} while (buffer[0] == '#');
/* Ignore maxval */
hdu = fits_add_hdu (fitsout); /* Create a HDU for the FITS file */
if (hdu == NULL) goto err_return;
@ -2057,7 +2053,7 @@ int pgmraw_to_fits (char *pgmfile, char *fitsfile)
fits_add_card (hdu, "");
fits_add_card (hdu, "HISTORY THIS FITS FILE WAS GENERATED BY FITSRW\
USING PGMRAW_TO_FITS");
USING PGMRAW_TO_FITS");
/* Write the header. Blocking is done automatically */
if (fits_write_header (fitsout, hdu) < 0) goto err_return;
@ -2086,7 +2082,7 @@ int pgmraw_to_fits (char *pgmfile, char *fitsfile)
retval = 0;
err_return:
if (fitsout) fits_close (fitsout);
if (pgmin) fclose (pgmin);

File diff suppressed because it is too large Load Diff

View File

@ -22,11 +22,11 @@
#include "config.h"
#include <errno.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <time.h>
#include <glib/gstdio.h>
#include <libgimp/gimp.h>
#include <libgimp/gimpui.h>
@ -405,7 +405,7 @@ file_response_callback (GtkFileChooser *chooser,
return;
}
f = fopen (filename, "r");
f = g_fopen (filename, "r");
if (f == NULL)
{
@ -436,7 +436,7 @@ file_response_callback (GtkFileChooser *chooser,
}
else
{
FILE *f = fopen (filename, "w");
FILE *f = g_fopen (filename, "w");
if (NULL == f)
{

View File

@ -26,9 +26,7 @@
#include "config.h"
#include <math.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <gtk/gtk.h>

View File

@ -25,12 +25,6 @@
#include "config.h"
#include <math.h>
#include <stdio.h>
#include <string.h>
#include <gtk/gtk.h>
#include <libgimp/gimp.h>
#include <libgimp/gimpui.h>

View File

@ -25,12 +25,6 @@
#include "config.h"
#include <math.h>
#include <stdio.h>
#include <string.h>
#include <gtk/gtk.h>
#include <libgimp/gimp.h>
#include <libgimp/gimpui.h>

View File

@ -24,17 +24,15 @@
#include "config.h"
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <errno.h>
#ifdef HAVE_UNISTD_H
#include <unistd.h>
#endif
#include <string.h>
#include <gtk/gtk.h>
#include <glib.h>
#ifdef G_OS_WIN32
#include <libgimpbase/gimpwin32-io.h>

View File

@ -24,15 +24,9 @@
#include "config.h"
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#ifdef HAVE_UNISTD_H
#include <unistd.h>
#endif
#include <gtk/gtk.h>
#include <libgimp/gimp.h>
#include <libgimp/gimpui.h>

View File

@ -25,12 +25,7 @@
#include "config.h"
#include <math.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <gtk/gtk.h>
#include <libgimp/gimp.h>
#include <libgimp/gimpui.h>
@ -40,6 +35,7 @@
#include "libgimp/stdplugins-intl.h"
static void d_draw_ellipse (GfigObject *obj);
static void d_paint_ellipse (GfigObject *obj);
static GfigObject *d_copy_ellipse (GfigObject *obj);

View File

@ -24,12 +24,8 @@
#include "config.h"
#include <math.h>
#include <stdio.h>
#include <stdlib.h>
#include <gtk/gtk.h>
#include <libgimp/gimp.h>
#include "gfig.h"
@ -37,6 +33,7 @@
#include "libgimp/stdplugins-intl.h"
/* For the isometric grid */
#define SQRT3 1.73205080756887729353 /* Square root of 3 */
#define SIN_1o6PI_RAD 0.5 /* Sine 1/6 Pi Radians */

View File

@ -25,12 +25,6 @@
#include "config.h"
#include <math.h>
#include <stdio.h>
#include <string.h>
#include <gtk/gtk.h>
#include <libgimp/gimp.h>
#include <libgimp/gimpui.h>

View File

@ -25,12 +25,6 @@
#include "config.h"
#include <math.h>
#include <stdio.h>
#include <string.h>
#include <gtk/gtk.h>
#include <libgimp/gimp.h>
#include <libgimp/gimpui.h>

View File

@ -24,11 +24,6 @@
#include "config.h"
#include <stdio.h>
#include <string.h>
#include <gtk/gtk.h>
#include <libgimp/gimp.h>
#include <libgimp/gimpui.h>

View File

@ -25,12 +25,6 @@
#include "config.h"
#include <math.h>
#include <stdio.h>
#include <string.h>
#include <gtk/gtk.h>
#include <libgimp/gimp.h>
#include <libgimp/gimpui.h>

View File

@ -25,12 +25,7 @@
#include "config.h"
#include <math.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <gtk/gtk.h>
#include <libgimp/gimp.h>
#include <libgimp/gimpui.h>

View File

@ -25,12 +25,6 @@
#include "config.h"
#include <math.h>
#include <stdio.h>
#include <string.h>
#include <gtk/gtk.h>
#include <libgimp/gimp.h>
#include <libgimp/gimpui.h>

View File

@ -1,12 +1,33 @@
/*
* Copyright (C) 1995 Spencer Kimball and Peter Mattis
*
* This is a plug-in for the GIMP.
*
* Generates images containing vector type drawings.
*
* Copyright (C) 1997 Andy Thomas alt@picnic.demon.co.uk
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*
*/
#include "config.h"
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <gtk/gtk.h>
#include <libgimp/gimp.h>
#include <libgimp/gimpui.h>

View File

@ -24,22 +24,19 @@
#include "config.h"
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <stdlib.h>
#include <errno.h>
#ifdef HAVE_UNISTD_H
#include <unistd.h>
#endif
#include <gtk/gtk.h>
#include <glib/gstdio.h>
#include <libgimp/gimp.h>
#include <libgimp/gimpui.h>
#include "libgimp/stdplugins-intl.h"
#include "gfig.h"
#include "gfig-style.h"
#include "gfig-dialog.h"
@ -56,6 +53,9 @@
#include "gfig-star.h"
#include "gfig-stock.h"
#include "libgimp/stdplugins-intl.h"
/***** Magic numbers *****/
#define GFIG_HEADER "GFIG Version 0.2\n"
@ -423,7 +423,7 @@ gfig_load (const gchar *filename,
printf ("Loading %s (%s)\n", filename, name);
#endif /* DEBUG */
fp = fopen (filename, "r");
fp = g_fopen (filename, "r");
if (!fp)
{
g_message (_("Could not open '%s' for reading: %s"),
@ -714,14 +714,17 @@ gfig_save_as_parasite (void)
string = gfig_save_as_string ();
parasite = gimp_parasite_new ("gfig", GIMP_PARASITE_PERSISTENT | GIMP_PARASITE_UNDOABLE,
parasite = gimp_parasite_new ("gfig",
GIMP_PARASITE_PERSISTENT |
GIMP_PARASITE_UNDOABLE,
string->len, string->str);
g_string_free (string, TRUE);
if (!gimp_drawable_parasite_attach (gfig_context->drawable_id, parasite))
{
g_message (_("Error trying to save figure as a parasite: can't attach parasite to drawable.\n"));
g_message (_("Error trying to save figure as a parasite: "
"can't attach parasite to drawable."));
gimp_parasite_free (parasite);
return FALSE;
}
@ -739,10 +742,12 @@ gfig_load_from_parasite (void)
GFigObj *gfig;
fname = gimp_temp_name ("gfigtmp");
fp = fopen (fname, "w");
fp = g_fopen (fname, "w");
if (!fp)
{
g_message (_("Error trying to open temp file '%s'for parasite loading.\n"), fname);
g_message (_("Error trying to open temporary file '%s' "
"for parasite loading: %s"),
gimp_filename_to_utf8 (fname), g_strerror (errno));
return NULL;
}
@ -760,7 +765,7 @@ gfig_load_from_parasite (void)
fclose (fp);
gfig = gfig_load (fname, "(none)");
unlink (fname);
g_unlink (fname);
return (gfig);
}
@ -774,7 +779,7 @@ gfig_save_callbk (void)
savename = gfig_context->current_obj->filename;
fp = fopen (savename, "w+");
fp = g_fopen (savename, "w+");
if (!fp)
{
@ -788,12 +793,9 @@ gfig_save_callbk (void)
fwrite (string->str, string->len, 1, fp);
if (ferror (fp))
g_message ("Failed to write file\n");
g_message ("Failed to write file.");
else
{
gfig_context->current_obj->obj_status &= ~(GFIG_MODIFIED | GFIG_READONLY);
}
gfig_context->current_obj->obj_status &= ~(GFIG_MODIFIED | GFIG_READONLY);
fclose (fp);
}

View File

@ -33,19 +33,16 @@
#include "config.h"
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <stdlib.h>
#include <errno.h>
#include <time.h>
#include <sys/types.h>
#include <sys/stat.h>
#ifdef HAVE_UNISTD_H
#include <unistd.h>
#endif
#include <gtk/gtk.h>
#include <glib/gstdio.h>
#include <glib-object.h>
#include <libgimpcolor/gimpcolor.h>
@ -1256,7 +1253,7 @@ gflare_load (const gchar *filename,
g_return_val_if_fail (filename != NULL, NULL);
fp = fopen (filename, "r");
fp = g_fopen (filename, "r");
if (!fp)
{
g_message (_("Failed to open GFlare file '%s': %s"),
@ -1476,7 +1473,7 @@ gflare_save (GFlare *gflare)
g_free (path);
}
fp = fopen (gflare->filename, "w");
fp = g_fopen (gflare->filename, "w");
if (!fp)
{
g_message (_("Failed to write GFlare file '%s': %s"),
@ -3197,7 +3194,8 @@ dlg_selector_do_delete_callback (GtkWidget *widget,
/* Delete old one from disk and memory */
if (old_gflare->filename)
unlink (old_gflare->filename);
g_unlink (old_gflare->filename);
gflare_free (old_gflare);
/* Update */
@ -4190,7 +4188,9 @@ preview_render_start (Preview *preview)
preview->init_done = FALSE;
preview->current_y = 0;
preview->drawn_y = 0;
preview->timeout_tag = g_timeout_add (100, (GSourceFunc) preview_render_start_2, preview);
preview->timeout_tag = g_timeout_add (100,
(GSourceFunc) preview_render_start_2,
preview);
}
static gint

View File

@ -17,16 +17,17 @@
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*
*/
/*
* This code can be used to read and write FLI movies. It is currently
* only used for the GIMP fli plug-in, but it can be used for other
* programs, too.
*/
#include <stdio.h>
#include <stdlib.h>
#include "config.h"
#include <string.h>
#include <stdio.h>
#include "fli.h"
@ -160,7 +161,7 @@ void fli_read_frame(FILE *f, s_fli_header *fli_header, unsigned char *old_frameb
if (chunk.size & 1) chunk.size++;
fseek(f,chunkpos+chunk.size,SEEK_SET);
}
} /* else: unknown, skip */
} /* else: unknown, skip */
fseek(f, framepos+fli_frame.size, SEEK_SET);
}
@ -180,8 +181,8 @@ void fli_write_frame(FILE *f, s_fli_header *fli_header, unsigned char *old_frame
fli_frame.magic=FRAME;
fli_frame.chunks=0;
/*
* create color chunk
/*
* create color chunk
*/
if (fli_header->magic == HEADER_FLI) {
if (fli_write_color(f, fli_header, old_cmap, cmap)) fli_frame.chunks++;
@ -208,7 +209,7 @@ void fli_write_frame(FILE *f, s_fli_header *fli_header, unsigned char *old_frame
fli_write_lc(f, fli_header, old_framebuf, framebuf);
}
fli_frame.chunks++;
frameend=ftell(f);
fli_frame.size=frameend-framepos;
fseek(f, framepos, SEEK_SET);
@ -254,7 +255,7 @@ int fli_write_color(FILE *f, s_fli_header *fli_header, unsigned char *old_cmap,
{
unsigned long chunkpos;
unsigned short num_packets;
s_fli_chunk chunk;
s_fli_chunk chunk;
chunkpos=ftell(f);
fseek(f, chunkpos+8, SEEK_SET);
num_packets=0;
@ -270,12 +271,12 @@ int fli_write_color(FILE *f, s_fli_header *fli_header, unsigned char *old_cmap,
unsigned short num_packets, cnt_skip, cnt_col, col_pos, col_start;
num_packets=0; col_pos=0;
do {
cnt_skip=0;
cnt_skip=0;
while ((col_pos<256) && (old_cmap[col_pos*3+0]==cmap[col_pos*3+0]) && (old_cmap[col_pos*3+1]==cmap[col_pos*3+1]) && (old_cmap[col_pos*3+2]==cmap[col_pos*3+2])) {
cnt_skip++; col_pos++;
}
col_start=col_pos;
cnt_col=0;
cnt_col=0;
while ((col_pos<256) && !((old_cmap[col_pos*3+0]==cmap[col_pos*3+0]) && (old_cmap[col_pos*3+1]==cmap[col_pos*3+1]) && (old_cmap[col_pos*3+2]==cmap[col_pos*3+2]))) {
cnt_col++; col_pos++;
}
@ -327,14 +328,14 @@ void fli_read_color_2(FILE *f, s_fli_header *fli_header, unsigned char *old_cmap
cmap[col_pos]=fli_read_char(f);
}
return;
}
}
for (col_cnt=skip_col; (col_cnt>0) && (col_pos<768); col_cnt--) {
cmap[col_pos]=old_cmap[col_pos];col_pos++;
cmap[col_pos]=old_cmap[col_pos];col_pos++;
cmap[col_pos]=old_cmap[col_pos];col_pos++;
}
for (col_cnt=num_col; (col_cnt>0) && (col_pos<768); col_cnt--) {
cmap[col_pos++]=fli_read_char(f);
cmap[col_pos++]=fli_read_char(f);
cmap[col_pos++]=fli_read_char(f);
cmap[col_pos++]=fli_read_char(f);
}
@ -345,7 +346,7 @@ int fli_write_color_2(FILE *f, s_fli_header *fli_header, unsigned char *old_cmap
{
unsigned long chunkpos;
unsigned short num_packets;
s_fli_chunk chunk;
s_fli_chunk chunk;
chunkpos=ftell(f);
fseek(f, chunkpos+8, SEEK_SET);
num_packets=0;
@ -361,12 +362,12 @@ int fli_write_color_2(FILE *f, s_fli_header *fli_header, unsigned char *old_cmap
unsigned short num_packets, cnt_skip, cnt_col, col_pos, col_start;
num_packets=0; col_pos=0;
do {
cnt_skip=0;
cnt_skip=0;
while ((col_pos<256) && (old_cmap[col_pos*3+0]==cmap[col_pos*3+0]) && (old_cmap[col_pos*3+1]==cmap[col_pos*3+1]) && (old_cmap[col_pos*3+2]==cmap[col_pos*3+2])) {
cnt_skip++; col_pos++;
}
col_start=col_pos;
cnt_col=0;
cnt_col=0;
while ((col_pos<256) && !((old_cmap[col_pos*3+0]==cmap[col_pos*3+0]) && (old_cmap[col_pos*3+1]==cmap[col_pos*3+1]) && (old_cmap[col_pos*3+2]==cmap[col_pos*3+2]))) {
cnt_col++; col_pos++;
}
@ -410,7 +411,7 @@ void fli_read_black(FILE *f, s_fli_header *fli_header, unsigned char *framebuf)
void fli_write_black(FILE *f, s_fli_header *fli_header, unsigned char *framebuf)
{
s_fli_chunk chunk;
s_fli_chunk chunk;
chunk.size=6;
chunk.magic=FLI_BLACK;
@ -429,9 +430,9 @@ void fli_read_copy(FILE *f, s_fli_header *fli_header, unsigned char *framebuf)
void fli_write_copy(FILE *f, s_fli_header *fli_header, unsigned char *framebuf)
{
unsigned long chunkpos;
s_fli_chunk chunk;
s_fli_chunk chunk;
chunkpos=ftell(f);
fseek(f, chunkpos+6, SEEK_SET);
fwrite(framebuf, fli_header->width, fli_header->height, f);
@ -441,7 +442,7 @@ void fli_write_copy(FILE *f, s_fli_header *fli_header, unsigned char *framebuf)
fseek(f, chunkpos, SEEK_SET);
fli_write_long(f, chunk.size);
fli_write_short(f, chunk.magic);
if (chunk.size & 1) chunk.size++;
fseek(f,chunkpos+chunk.size,SEEK_SET);
}
@ -462,10 +463,10 @@ void fli_read_brun(FILE *f, s_fli_header *fli_header, unsigned char *framebuf)
unsigned short ps;
ps=fli_read_char(f);
if (ps & 0x80) {
unsigned short len;
unsigned short len;
for (len=-(signed char)ps; len>0; len--) {
pos[xc++]=fli_read_char(f);
}
}
} else {
unsigned char val;
val=fli_read_char(f);
@ -473,16 +474,16 @@ void fli_read_brun(FILE *f, s_fli_header *fli_header, unsigned char *framebuf)
xc+=ps;
}
}
}
}
}
void fli_write_brun(FILE *f, s_fli_header *fli_header, unsigned char *framebuf)
{
unsigned long chunkpos;
s_fli_chunk chunk;
s_fli_chunk chunk;
unsigned short yc;
unsigned char *linebuf;
chunkpos=ftell(f);
fseek(f, chunkpos+6, SEEK_SET);
@ -496,7 +497,7 @@ void fli_write_brun(FILE *f, s_fli_header *fli_header, unsigned char *framebuf)
while (xc < fli_header->width) {
pc=1;
while ((pc<120) && ((xc+pc)<fli_header->width) && (linebuf[xc+pc] == linebuf[xc])) {
pc++;
pc++;
}
if (pc>2) {
if (tc>0) {
@ -527,7 +528,7 @@ void fli_write_brun(FILE *f, s_fli_header *fli_header, unsigned char *framebuf)
fwrite(linebuf+t1, 1, tc, f);
tc=0;
}
lineend=ftell(f);
lineend=ftell(f);
fseek(f, linepos, SEEK_SET);
fli_write_char(f, bc);
fseek(f, lineend, SEEK_SET);
@ -539,13 +540,13 @@ void fli_write_brun(FILE *f, s_fli_header *fli_header, unsigned char *framebuf)
fseek(f, chunkpos, SEEK_SET);
fli_write_long(f, chunk.size);
fli_write_short(f, chunk.magic);
if (chunk.size & 1) chunk.size++;
fseek(f,chunkpos+chunk.size,SEEK_SET);
}
/*
* This is the delta-compression method from the classic Autodesk Animator.
* This is the delta-compression method from the classic Autodesk Animator.
* It's basically the RLE method from above, but it allows to skip unchanged
* lines at the beginning and end of an image, and unchanged pixels in a line
* This chunk is used in FLI files.
@ -578,30 +579,30 @@ void fli_read_lc(FILE *f, s_fli_header *fli_header, unsigned char *old_framebuf,
xc+=ps;
}
}
}
}
}
void fli_write_lc(FILE *f, s_fli_header *fli_header, unsigned char *old_framebuf, unsigned char *framebuf)
{
unsigned long chunkpos;
s_fli_chunk chunk;
s_fli_chunk chunk;
unsigned short yc, firstline, numline, lastline;
unsigned char *linebuf, *old_linebuf;
chunkpos=ftell(f);
fseek(f, chunkpos+6, SEEK_SET);
/* first check, how many lines are unchanged at the beginning */
firstline=0;
while ((memcmp(old_framebuf+(firstline*fli_header->width), framebuf+(firstline*fli_header->width), fli_header->width)==0) && (firstline<fli_header->height)) firstline++;
/* then check from the end, how many lines are unchanged */
if (firstline<fli_header->height) {
lastline=fli_header->height-1;
while ((memcmp(old_framebuf+(lastline*fli_header->width), framebuf+(lastline*fli_header->width), fli_header->width)==0) && (lastline>firstline)) lastline--;
numline=(lastline-firstline)+1;
} else {
numline=0;
numline=0;
}
if (numline==0) firstline=0;
@ -651,7 +652,7 @@ void fli_write_lc(FILE *f, s_fli_header *fli_header, unsigned char *old_framebuf
xc+=tc;
}
}
lineend=ftell(f);
lineend=ftell(f);
fseek(f, linepos, SEEK_SET);
fli_write_char(f, bc);
fseek(f, lineend, SEEK_SET);
@ -663,7 +664,7 @@ void fli_write_lc(FILE *f, s_fli_header *fli_header, unsigned char *old_framebuf
fseek(f, chunkpos, SEEK_SET);
fli_write_long(f, chunk.size);
fli_write_short(f, chunk.magic);
if (chunk.size & 1) chunk.size++;
fseek(f,chunkpos+chunk.size,SEEK_SET);
}
@ -717,5 +718,5 @@ void fli_read_lc_2(FILE *f, s_fli_header *fli_header, unsigned char *old_framebu
}
if (lpf) pos[xc]=lpn;
yc++;
}
}
}

View File

@ -53,11 +53,9 @@
#include <config.h>
#include <errno.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <gtk/gtk.h>
#include <glib/gstdio.h>
#include <libgimp/gimp.h>
#include <libgimp/gimpui.h>
@ -417,7 +415,7 @@ get_info (const gchar *filename,
*width = 0; *height = 0; *frames = 0;
file = fopen (filename ,"rb");
file = g_fopen (filename ,"rb");
if (!file)
{
@ -453,7 +451,7 @@ load_image (const gchar *filename,
gint cnt;
file = fopen (filename ,"rb");
file = g_fopen (filename ,"rb");
if (!file)
{
g_message (_("Could not open '%s' for reading: %s"),
@ -706,7 +704,7 @@ save_image (const gchar *filename,
fli_header.aspect_y = 1; /* ... as GIMP supports it. */
fli_header.oframe1 = fli_header.oframe2 = 0; /* will be fixed during the write */
file = fopen (filename ,"wb");
file = g_fopen (filename ,"wb");
if (!file)
{
g_message (_("Could not open '%s' for writing: %s"),

View File

@ -1,14 +1,13 @@
#include "config.h"
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <errno.h>
#include <gtk/gtk.h>
#include <glib/gstdio.h>
#include <libgimpmath/gimpmath.h>
#include <libgimp/gimp.h>
#include <libgimpmath/gimpmath.h>
#include "ppmtool.h"
#include "gimpressionist.h"
@ -227,11 +226,12 @@ fopen_from_search_path (const gchar * fn, const char * mode)
{
FILE * f;
gchar * full_filename;
f = fopen (fn, mode);
f = g_fopen (fn, mode);
if (!f)
{
full_filename = findfile (fn);
f = fopen (full_filename, mode);
f = g_fopen (full_filename, mode);
g_free (full_filename);
}
return f;
@ -250,7 +250,8 @@ load_gimp_brush (const gchar *fn, ppm_t *p)
if (!f)
{
fprintf (stderr, "load_gimp_brush: Unable to open file \"%s\"!\n", fn);
g_printerr ("load_gimp_brush: Unable to open file \"%s\"!\n",
gimp_filename_to_utf8 (fn));
ppm_new (p, 10,10);
return;
}
@ -274,7 +275,7 @@ load_gimp_brush (const gchar *fn, ppm_t *p)
}
}
fclose (f);
free (ptr);
g_free (ptr);
}
void
@ -296,7 +297,8 @@ ppm_load (const char *fn, ppm_t *p)
if (!f)
{
fprintf (stderr, "ppm_load: Unable to open file \"%s\"!\n", fn);
g_printerr ("ppm_load: Unable to open file \"%s\"!\n",
gimp_filename_to_utf8 (fn));
ppm_new (p, 10,10);
return;
}
@ -307,8 +309,8 @@ ppm_load (const char *fn, ppm_t *p)
if (strcmp (line, "P5"))
{
fclose (f);
printf ("ppm_load: File \"%s\" not PPM/PGM? (line=\"%s\")%c\n",
fn, line, 7);
g_printerr ("ppm_load: File \"%s\" not PPM/PGM? (line=\"%s\")%c\n",
gimp_filename_to_utf8 (fn), line, 7);
ppm_new (p, 10,10);
return;
}
@ -320,8 +322,8 @@ ppm_load (const char *fn, ppm_t *p)
readline (f, line, 200);
if (strcmp (line, "255"))
{
printf ("ppm_load: File \"%s\" not valid PPM/PGM? (line=\"%s\")%c\n",
fn, line, 7);
g_printerr ("ppm_load: File \"%s\" not valid PPM/PGM? (line=\"%s\")%c\n",
gimp_filename_to_utf8 (fn), line, 7);
ppm_new (p, 10,10);
return;
}
@ -619,7 +621,7 @@ ppm_pad (ppm_t *p, int left,int right, int top, int bottom, guchar *bg)
void
ppm_save (ppm_t *p, const char *fn)
{
FILE *f = fopen (fn, "wb");
FILE *f = g_fopen (fn, "wb");
if (!f)
{

View File

@ -1,15 +1,16 @@
#include "config.h"
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <stdlib.h>
#include <sys/stat.h>
#include <sys/types.h>
#ifdef HAVE_UNISTD_H
#include <unistd.h>
#endif
#include <gtk/gtk.h>
#include <glib/gstdio.h>
#include <libgimp/gimp.h>
#include <libgimp/gimpui.h>
@ -90,7 +91,7 @@ get_early_line_from_preset (gchar *full_path, const gchar *prefix)
gint prefix_len, line_idx;
prefix_len = strlen (prefix);
f = fopen (full_path, "rt");
f = g_fopen (full_path, "rt");
if (f)
{
/* Skip the preset magic. */
@ -227,10 +228,11 @@ load_old_preset (const gchar *fname)
FILE *f;
int len;
f = fopen (fname, "rb");
f = g_fopen (fname, "rb");
if (!f)
{
fprintf (stderr, "Error opening file \"%s\" for reading!%c\n", fname, 7);
g_printerr ("Error opening file \"%s\" for reading!\n",
gimp_filename_to_utf8 (fname));
return -1;
}
len = fread (&pcvals, 1, sizeof (pcvals), f);
@ -447,10 +449,11 @@ load_preset (const gchar *fn)
char line[1024] = "";
FILE *f;
f = fopen (fn, "rt");
f = g_fopen (fn, "rt");
if (!f)
{
fprintf (stderr, "Error opening file \"%s\" for reading!\n", fn);
g_printerr ("Error opening file \"%s\" for reading!\n",
gimp_filename_to_utf8 (fn));
return -1;
}
fgets (line, 10, f);
@ -567,9 +570,7 @@ delete_preset (GtkWidget *w, GtkTreeSelection *selection)
{
/* Don't delete global presets - bug # 147483 */
if (can_delete_preset (abs))
{
unlink (abs);
}
g_unlink (abs);
g_free (abs);
}
@ -693,7 +694,7 @@ save_preset (void)
if (!thispath)
{
g_printerr ("Internal error: (save_preset) thispath == NULL");
g_printerr ("Internal error: (save_preset) thispath == NULL\n");
return;
}
@ -704,12 +705,13 @@ save_preset (void)
if (!g_file_test (presets_dir_path, G_FILE_TEST_IS_DIR))
{
if (mkdir (presets_dir_path,
S_IRUSR | S_IWUSR | S_IXUSR |
S_IRGRP | S_IXGRP |
S_IROTH | S_IXOTH) == -1)
if (g_mkdir (presets_dir_path,
S_IRUSR | S_IWUSR | S_IXUSR |
S_IRGRP | S_IXGRP |
S_IROTH | S_IXOTH) == -1)
{
g_printerr ("Error creating folder \"%s\"!\n", presets_dir_path);
g_printerr ("Error creating folder \"%s\"!\n",
gimp_filename_to_utf8 (presets_dir_path));
g_free (presets_dir_path);
return;
}
@ -737,10 +739,11 @@ save_preset (void)
return;
}
f = fopen (fname, "wt");
f = g_fopen (fname, "wt");
if (!f)
{
g_printerr ("Error opening file \"%s\" for writing!%c\n", fname, 7);
g_printerr ("Error opening file \"%s\" for writing!\n",
gimp_filename_to_utf8 (fname));
g_free (fname);
return;
}

View File

@ -30,11 +30,10 @@
#include "config.h"
#include <stdio.h>
#include <string.h>
#include <errno.h>
#include <gtk/gtk.h>
#include <glib/gstdio.h>
#include <libgimp/gimp.h>
#include <libgimp/gimpui.h>
@ -2399,7 +2398,7 @@ ifsfile_save_response (GtkWidget *dialog,
str = ifsvals_stringify (&ifsvals, elements);
fh = fopen (filename, "w");
fh = g_fopen (filename, "w");
if (! fh)
{
gchar *message =

View File

@ -22,7 +22,6 @@
#include "config.h"
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <gdk/gdk.h>

View File

@ -24,7 +24,6 @@
#include "config.h"
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <setjmp.h>

View File

@ -18,11 +18,12 @@
#include "config.h"
#include <stdio.h>
#include <string.h>
#include <errno.h>
#include <setjmp.h>
#include <glib/gstdio.h>
#include <jpeglib.h>
#include <jerror.h>
@ -128,7 +129,7 @@ load_image (const gchar *filename,
jerr.pub.output_message = my_output_message;
}
if ((infile = fopen (filename, "rb")) == NULL)
if ((infile = g_fopen (filename, "rb")) == NULL)
{
g_message (_("Could not open '%s' for reading: %s"),
gimp_filename_to_utf8 (filename), g_strerror (errno));
@ -830,7 +831,7 @@ load_thumbnail_image (const gchar *filename,
jerr.pub.emit_message = my_emit_message;
jerr.pub.output_message = my_output_message;
if ((infile = fopen (filename, "rb")) == NULL)
if ((infile = g_fopen (filename, "rb")) == NULL)
{
g_message (_("Could not open '%s' for reading: %s"),
gimp_filename_to_utf8 (filename), g_strerror (errno));

View File

@ -18,7 +18,6 @@
#include "config.h"
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <errno.h>
@ -30,6 +29,8 @@
#include <unistd.h>
#endif
#include <glib/gstdio.h>
#include <jpeglib.h>
#include <jerror.h>
@ -136,7 +137,7 @@ background_jpeg_save (PreviewPersistent *pp)
}
/* we cleanup here (load_image doesn't run in the background) */
unlink (pp->file_name);
g_unlink (pp->file_name);
if (abort_me == &(pp->abort_me))
abort_me = NULL;
@ -253,7 +254,7 @@ save_image (const gchar *filename,
* VERY IMPORTANT: use "b" option to fopen() if you are on a machine that
* requires it in order to write binary files.
*/
if ((outfile = fopen (filename, "wb")) == NULL)
if ((outfile = g_fopen (filename, "wb")) == NULL)
{
g_message (_("Could not open '%s' for writing: %s"),
gimp_filename_to_utf8 (filename), g_strerror (errno));

View File

@ -39,9 +39,6 @@
#include "config.h"
#include <stdio.h>
#include <stdlib.h>
#include "libgimp/gimp.h"
#include "libgimp/gimpui.h"

View File

@ -43,9 +43,6 @@
#include "config.h"
#include <stdio.h>
#include <stdlib.h>
#include <libgimp/gimp.h>
#include <libgimp/gimpui.h>

View File

@ -24,14 +24,16 @@
#include "config.h"
#include <stdlib.h>
#include <sys/types.h>
#include <signal.h>
#include <sys/wait.h>
#include <unistd.h>
#include <stdio.h>
#include <string.h>
#include <sys/types.h>
#include <sys/wait.h>
#include <signal.h>
#ifdef HAVE_UNISTD_H
#include <unistd.h>
#endif
#include "libgimp/gimp.h"
#include "libgimp/gimpui.h"

View File

@ -38,11 +38,8 @@
#include "config.h"
#include <stdio.h>
#include <gtk/gtk.h>
#include "libgimp/gimp.h"
#include "libgimp/gimpui.h"
#include "rcm.h"
#include "rcm_misc.h"

View File

@ -38,14 +38,8 @@
#include "config.h"
#include <stdio.h>
#include <stdlib.h>
#include <gtk/gtk.h>
#include "libgimpmath/gimpmath.h"
#include "libgimpwidgets/gimpwidgets.h"
#include "libgimp/gimp.h"
#include "libgimp/gimpui.h"
#include "rcm.h"
#include "rcm_misc.h"

View File

@ -38,9 +38,6 @@
#include "config.h"
#include <stdio.h>
#include <stdlib.h>
#include <libgimp/gimp.h>
#include <libgimp/gimpui.h>

View File

@ -38,9 +38,6 @@
#include "config.h"
#include <stdio.h>
#include <stdlib.h>
#include <libgimp/gimp.h>
#include <libgimp/gimpui.h>

View File

@ -38,11 +38,6 @@
#include "config.h"
#include <stdio.h>
#include <stdlib.h>
#include <gtk/gtk.h>
#include "libgimp/gimp.h"
#include "libgimp/gimpui.h"

View File

@ -18,15 +18,6 @@
#include "config.h"
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <sys/types.h>
#if HAVE_UNISTD_H
#include <unistd.h>
#endif
#include <sys/stat.h>
#include <gdk/gdkkeysyms.h>
#include <gtk/gtk.h>

View File

@ -18,13 +18,9 @@
#include "config.h"
#include <glib.h> /* Include early for obscure Win32 build reasons */
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <sys/types.h>
#include <gtk/gtk.h>
#include <glib.h>
#ifdef G_OS_WIN32
#define WIN32_LEAN_AND_MEAN

View File

@ -18,22 +18,23 @@
#include "config.h"
#include <glib.h> /* For G_OS_WIN32 */
#include <stdarg.h>
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <errno.h>
#include <time.h>
#ifdef HAVE_UNISTD_H
#include <unistd.h>
#endif
#include <time.h>
#include <errno.h>
#ifdef HAVE_SYS_TIME_H
#include <sys/time.h>
#endif
#include <sys/types.h>
#include <glib.h>
#ifdef G_OS_WIN32
#include <winsock2.h>
#include <libgimpbase/gimpwin32-io.h>
@ -48,7 +49,7 @@
#include <sys/select.h>
#endif /* HAVE_SYS_SELECT_H */
#include <gtk/gtk.h>
#include <glib/gstdio.h>
#include "libgimp/gimp.h"
#include "libgimp/gimpui.h"
@ -346,7 +347,7 @@ server_start (gint port,
/* Setup up the server log file */
if (logfile && *logfile)
server_log_file = fopen (logfile, "a");
server_log_file = g_fopen (logfile, "a");
else
server_log_file = NULL;

View File

@ -18,8 +18,9 @@
#include "config.h"
#include <errno.h>
#include <stdio.h>
#include <errno.h>
#if HAVE_UNISTD_H
#include <unistd.h>
#endif
@ -119,7 +120,7 @@ read_command (GString *command)
return FALSE;
}
static void
static void
script_fu_text_console_interface (void)
{
GString *command = g_string_new (NULL);

View File

@ -18,14 +18,8 @@
#include "config.h"
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#if HAVE_UNISTD_H
#include <unistd.h>
#endif
#include <gtk/gtk.h>
#include <libgimp/gimp.h>
#include "siod/siod.h"

View File

@ -16,10 +16,10 @@ You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
#include <stdio.h>
#include "config.h"
#include <glib.h>
#include "config.h"
#include "global.h"
#include "curve.h"

View File

@ -18,12 +18,9 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
#include "config.h"
#include <float.h>
#include <math.h>
#include <errno.h>
#include <math.h>
#include <stdio.h>
#include <stdlib.h>
#include <assert.h>
#include "libgimp/gimp.h"
@ -87,7 +84,7 @@ my_acosd (real v)
real
slope (real_coordinate_type coord1, real_coordinate_type coord2)
{
assert (coord2.x - coord1.x != 0);
g_assert (coord2.x - coord1.x != 0);
return (coord2.y - coord1.y) / (coord2.x - coord1.x);
}

View File

@ -29,8 +29,6 @@
#include "config.h"
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "libgimp/gimp.h"

View File

@ -29,13 +29,11 @@
#include "config.h"
#include <stdio.h>
#include <stdlib.h>
#include <types.h>
#include <libgimp/gimp.h>
#include <libgimp/gimpui.h>
#include "types.h"
#define SCALE_WIDTH 100
#define SCALE_DIGITS 8

View File

@ -1,6 +1,4 @@
/*
* "$Id$"
*
* SGI image file plug-in for the GIMP.
*
* Copyright 1997-1998 Michael Sweet (mike@easysw.com)
@ -33,11 +31,7 @@
#include "config.h"
#include <stdio.h>
#include <stdlib.h>
#include <signal.h>
#include <gtk/gtk.h>
#include <string.h>
#include <libgimp/gimp.h>
#include <libgimp/gimpui.h>

View File

@ -1,6 +1,4 @@
/*
* "$Id$"
*
* SGI image file format library definitions.
*
* Copyright 1997-1998 Michael Sweet (mike@easysw.com)
@ -27,15 +25,6 @@
#ifndef _SGI_H_
# define _SGI_H_
# include "config.h"
# include <stdio.h>
# include <stdlib.h>
# ifdef HAVE_UNISTD_H
# include <unistd.h>
# endif
# include <string.h>
# ifdef __cplusplus
extern "C" {
# endif

View File

@ -1,6 +1,4 @@
/*
* "$Id$"
*
* SGI image file format library routines.
*
* Copyright 1997-1998 Michael Sweet (mike@easysw.com)
@ -38,6 +36,34 @@
* Revision History:
*
* $Log$
* Revision 1.9 2005/03/04 13:23:31 neo
* 2005-03-04 Sven Neumann <sven@gimp.org>
*
* * plug-ins/FractalExplorer
* * plug-ins/Lighting
* * plug-ins/bmp
* * plug-ins/dbbrowser
* * plug-ins/faxg3
* * plug-ins/fits
* * plug-ins/flame
* * plug-ins/gfig
* * plug-ins/gflare
* * plug-ins/gfli
* * plug-ins/gimpressionist
* * plug-ins/ifscompose
* * plug-ins/jpeg
* * plug-ins/maze
* * plug-ins/pagecurl
* * plug-ins/print
* * plug-ins/rcm
* * plug-ins/script-fu
* * plug-ins/sel2path
* * plug-ins/sgi
* * plug-ins/twain
* * plug-ins/winicon
* * plug-ins/xjt: ported to gstdio, removed unnecessary includes,
* minor fixes to filename handling here and there.
*
* Revision 1.8 2003/04/07 11:59:33 neo
* 2003-04-07 Sven Neumann <sven@gimp.org>
*
@ -73,6 +99,13 @@
* Initial revision
*/
#include "config.h"
#include <stdlib.h>
#include <string.h>
#include <glib/gstdio.h>
#include "sgi.h"
@ -225,9 +258,9 @@ sgiOpen(char *filename, /* I - File to open */
if (mode == SGI_READ)
file = fopen(filename, "rb");
file = g_fopen(filename, "rb");
else
file = fopen(filename, "wb+");
file = g_fopen(filename, "wb+");
if (file == NULL)
return (NULL);

View File

@ -59,9 +59,15 @@
* images.
* (07/23/04) v0.6 Added Mac OS X support.
*/
#include <stdio.h>
#include "config.h"
#include <string.h>
#include <glib/gstdio.h>
#include "libgimp/gimp.h"
#include "tw_dump.h"
#include "tw_func.h"
#include "tw_util.h"
@ -83,7 +89,7 @@ dumpPreTransferCallback(void *clientData)
* write to the root directory. Simplistic, but
* gets the job done.
*/
outputFile = fopen(DUMP_FILE, "wb");
outputFile = g_fopen(DUMP_FILE, "wb");
}
/*
@ -103,14 +109,14 @@ dumpBeginTransferCallback(pTW_IMAGEINFO imageInfo, void *clientData)
/* Keep going */
return TRUE;
}
/*
* dumpDataTransferCallback
*
* The following function is called for each memory
* block that is transferred from the data source.
*/
int
int
dumpDataTransferCallback(pTW_IMAGEINFO imageInfo,
pTW_IMAGEMEMXFER imageMemXfer,
void *clientData)
@ -130,7 +136,7 @@ dumpDataTransferCallback(pTW_IMAGEINFO imageInfo,
/* Keep going */
return TRUE;
}
/*
* dumpEndTransferCallback
*
@ -187,7 +193,7 @@ dumpPostTransferCallback(int pendingCount, void *clientData)
disableDS(twSession);
closeDS(twSession);
closeDSM(twSession);
/* Close the dump file */
fclose(outputFile);
@ -217,7 +223,7 @@ void readDumpedImage(pTW_SESSION twSession)
* write to the root directory. Simplistic, but
* gets the job done.
*/
FILE *inputFile = fopen(DUMP_FILE, "rb");
FILE *inputFile = g_fopen(DUMP_FILE, "rb");
/*
* Inform our application that we are getting ready
@ -242,9 +248,9 @@ void readDumpedImage(pTW_SESSION twSession)
1, imageMemXfer.BytesWritten, inputFile);
/* Call the data transfer callback function */
if (!(*twSession->transferFunctions->txfrDataCb)
(&imageInfo,
&imageMemXfer,
if (!(*twSession->transferFunctions->txfrDataCb)
(&imageInfo,
&imageMemXfer,
twSession->clientData))
return;

View File

@ -64,7 +64,7 @@
#include <glib.h> /* Needed when compiling with gcc */
#include <stdio.h>
#include <glib/gstdio.h>
#include <stdarg.h>
#include <stdlib.h>
@ -91,7 +91,7 @@ LogMessage(char *format, ...)
/* Open the log file as necessary */
if (!logFile)
logFile = fopen(DEBUG_LOGFILE, "w");
logFile = g_fopen(DEBUG_LOGFILE, "w");
time_of_day = time(NULL);
ctime_string = ctime(&time_of_day);

View File

@ -559,13 +559,13 @@ beginTransferCallback(pTW_IMAGEINFO imageInfo, void *clientData)
/* Create the GIMP image */
theClientData->image_id = gimp_image_new(imageInfo->ImageWidth,
imageInfo->ImageLength, imageType);
/* Set the actual resolution */
gimp_image_set_resolution (theClientData->image_id,
FIX32ToFloat(imageInfo->XResolution),
FIX32ToFloat(imageInfo->YResolution));
gimp_image_set_unit (theClientData->image_id, GIMP_UNIT_INCH);
/* Create a layer */
theClientData->layer_id = gimp_layer_new(theClientData->image_id,
_("Background"),

View File

@ -21,8 +21,6 @@
#include <config.h>
#include <stdio.h>
#include <libgimp/gimp.h>
#include <libgimp/gimpui.h>

View File

@ -23,7 +23,8 @@
#include <errno.h>
#include <string.h>
#include <stdio.h>
#include <glib/gstdio.h>
#include <libgimp/gimp.h>
@ -121,7 +122,7 @@ ico_init (const gchar *filename,
{
memset (ico, 0, sizeof (MsIcon));
if (! (ico->fp = fopen (filename, "r")))
if (! (ico->fp = g_fopen (filename, "r")))
{
g_message (_("Could not open '%s' for reading: %s"),
gimp_filename_to_utf8 (filename), g_strerror (errno));

View File

@ -22,9 +22,10 @@
#include "config.h"
#include <errno.h>
#include <stdio.h>
#include <string.h>
#include <glib/gstdio.h>
#include <libgimp/gimp.h>
#include <libgimp/gimpui.h>
@ -236,9 +237,9 @@ ico_init (const gchar *filename,
MsIcon *ico,
gint num_icons)
{
memset (ico, 0, sizeof(MsIcon));
memset (ico, 0, sizeof (MsIcon));
if (! (ico->fp = fopen (filename, "wb")))
if (! (ico->fp = g_fopen (filename, "wb")))
{
g_message (_("Could not open '%s' for writing: %s"),
gimp_filename_to_utf8 (filename), g_strerror (errno));

View File

@ -22,7 +22,6 @@
#include "config.h"
#include <string.h>
#include <stdio.h>
#include <libgimp/gimp.h>
#include <libgimp/gimpui.h>

View File

@ -31,10 +31,11 @@
#include "config.h"
#include <setjmp.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <setjmp.h>
#include <glib/gstdio.h>
/* Include for External Libraries */
#include <jpeglib.h>
@ -83,12 +84,12 @@ my_error_exit (j_common_ptr cinfo)
*/
gint32
xjpg_load_layer (char *filename,
gint32 image_id,
int image_type,
char *layer_name,
gdouble layer_opacity,
GimpLayerModeEffects layer_mode
xjpg_load_layer (const char *filename,
gint32 image_id,
int image_type,
char *layer_name,
gdouble layer_opacity,
GimpLayerModeEffects layer_mode
)
{
GimpPixelRgn l_pixel_rgn;
@ -110,7 +111,7 @@ xjpg_load_layer (char *filename,
l_layer_type = GIMP_GRAY_IMAGE;
if ((infile = fopen (filename, "rb")) == NULL)
if ((infile = g_fopen (filename, "rb")) == NULL)
{
g_warning ("can't open \"%s\"\n", filename);
return -1;
@ -267,10 +268,9 @@ xjpg_load_layer (char *filename,
*/
gint
xjpg_load_layer_alpha (char *filename,
gint32 image_id,
gint32 layer_id
)
xjpg_load_layer_alpha (const char *filename,
gint32 image_id,
gint32 layer_id)
{
GimpPixelRgn l_pixel_rgn;
GimpDrawable *l_drawable;
@ -297,7 +297,7 @@ xjpg_load_layer_alpha (char *filename,
/* add alpha channel */
gimp_layer_add_alpha (layer_id);
if ((infile = fopen (filename, "rb")) == NULL)
if ((infile = g_fopen (filename, "rb")) == NULL)
{
/* No alpha found, thats OK, use full opaque alpha channel
* (there is no need not store alpha channels on full opaque channels)
@ -373,7 +373,7 @@ xjpg_load_layer_alpha (char *filename,
/* Check if jpeg file can be used as alpha channel
*/
if((cinfo.output_components != 1) ||
if((cinfo.output_components != 1) ||
(cinfo.output_width != l_drawable->width) ||
(cinfo.output_height != l_drawable->height))
{
@ -381,7 +381,7 @@ xjpg_load_layer_alpha (char *filename,
fclose (infile);
return -1;
}
/* buffer to read in the layer and merge with the alpha from jpeg file */
l_dstbuf = g_new (guchar, l_tile_height * l_drawable->width * l_drawable->bpp);
@ -466,13 +466,12 @@ xjpg_load_layer_alpha (char *filename,
*/
gint32
xjpg_load_channel (char *filename,
gint32 image_id,
gint32 drawable_id,
char *channel_name,
gdouble channel_opacity,
guchar red, guchar green, guchar blue
)
xjpg_load_channel (const char *filename,
gint32 image_id,
gint32 drawable_id,
char *channel_name,
gdouble channel_opacity,
guchar red, guchar green, guchar blue)
{
GimpPixelRgn l_pixel_rgn;
GimpDrawable *l_drawable;
@ -493,7 +492,7 @@ xjpg_load_channel (char *filename,
cinfo.err = jpeg_std_error (&jerr.pub);
jerr.pub.error_exit = my_error_exit;
if ((infile = fopen (filename, "rb")) == NULL)
if ((infile = g_fopen (filename, "rb")) == NULL)
{
g_warning ("can't open \"%s\"\n", filename);
return -1;
@ -586,7 +585,7 @@ xjpg_load_channel (char *filename,
}
l_drawable = gimp_drawable_get (l_drawable_id);
if((l_drawable->width != cinfo.output_width)
|| (l_drawable->height != cinfo.output_height)
|| (l_drawable->bpp != cinfo.output_components) )
@ -664,17 +663,17 @@ xjpg_load_channel (char *filename,
* - save the drawable without alpha channel.
* (optional clear full transparent pixels to 0,
* resulting in better compression)
* - save the alpha channel
* - save the alpha channel
* ============================================================================
*/
gint
xjpg_save_drawable (char *filename,
gint32 image_ID,
gint32 drawable_ID,
gint save_mode,
t_JpegSaveVals *jsvals)
xjpg_save_drawable (const char *filename,
gint32 image_ID,
gint32 drawable_ID,
gint save_mode,
t_JpegSaveVals *jsvals)
{
GimpPixelRgn pixel_rgn;
GimpDrawable *drawable;
@ -698,7 +697,7 @@ xjpg_save_drawable (char *filename,
temp = NULL;
data = NULL;
l_alpha_sum = 0xff;
drawable = gimp_drawable_get (drawable_ID);
drawable_type = gimp_drawable_type (drawable_ID);
switch (drawable_type)
@ -711,7 +710,7 @@ xjpg_save_drawable (char *filename,
case GIMP_RGBA_IMAGE:
case GIMP_GRAYA_IMAGE:
break;
case GIMP_INDEXED_IMAGE:
/*g_message ("jpeg: cannot operate on indexed color images");*/
return FALSE;
@ -764,7 +763,7 @@ xjpg_save_drawable (char *filename,
* VERY IMPORTANT: use "b" option to fopen() if you are on a machine that
* requires it in order to write binary files.
*/
if ((outfile = fopen (filename, "wb")) == NULL)
if ((outfile = g_fopen (filename, "wb")) == NULL)
{
g_message ("can't open %s\n", filename);
return FALSE;
@ -846,7 +845,7 @@ xjpg_save_drawable (char *filename,
temp = (guchar *) g_malloc (cinfo.image_width * cinfo.input_components);
data = (guchar *) g_malloc (rowstride * gimp_tile_height ());
src = data;
while (cinfo.next_scanline < cinfo.image_height)
{
if ((cinfo.next_scanline % gimp_tile_height ()) == 0)
@ -927,7 +926,7 @@ xjpg_save_drawable (char *filename,
* == full opaque image. We can remove the file
* to save diskspace
*/
remove(filename);
g_remove(filename);
}
/* Step 7: release JPEG compression object */

View File

@ -47,35 +47,32 @@ typedef struct
} t_JpegSaveVals;
gint
xjpg_save_drawable (char *filename,
gint32 image_ID,
gint32 drawable_ID,
gint save_mode,
t_JpegSaveVals *jsvals);
gint
xjpg_save_drawable (const char *filename,
gint32 image_ID,
gint32 drawable_ID,
gint save_mode,
t_JpegSaveVals *jsvals);
gint32
xjpg_load_layer (char *filename,
gint32 image_id,
int image_type,
char *layer_name,
gdouble layer_opacity,
GimpLayerModeEffects layer_mode
);
xjpg_load_layer (const char *filename,
gint32 image_id,
int image_type,
char *layer_name,
gdouble layer_opacity,
GimpLayerModeEffects layer_mode);
gint
xjpg_load_layer_alpha (char *filename,
gint32 image_id,
gint32 layer_id
);
xjpg_load_layer_alpha (const char *filename,
gint32 image_id,
gint32 layer_id);
gint32
xjpg_load_channel (char *filename,
gint32 image_id,
gint32 drawable_id,
char *channel_name,
gdouble channel_opacity,
guchar red, guchar green, guchar blue
);
xjpg_load_channel (const char *filename,
gint32 image_id,
gint32 drawable_id,
char *channel_name,
gdouble channel_opacity,
guchar red, guchar green, guchar blue);
#endif

View File

@ -56,7 +56,6 @@
#include "config.h"
#include <errno.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <sys/types.h>
@ -66,7 +65,8 @@
#include <unistd.h>
#endif
#include <gtk/gtk.h>
#include <glib/gstdio.h>
#include <libgimp/gimp.h>
#include <libgimp/gimpui.h>
@ -74,9 +74,6 @@
#ifdef G_OS_WIN32
#include <process.h> /* getpid() */
#include <direct.h> /* _mkdir */
#define mkdir(path,mode) _mkdir(path)
#define mode_t int
#endif
/* XJT includes */
@ -1634,7 +1631,6 @@ save_xjt_image (const gchar *filename,
gchar *l_jpg_file;
gchar *l_cmd;
FILE *l_fp_prp;
mode_t l_mode_dir;
GimpImageBaseType l_image_type;
gint32 *l_layers_list;
@ -1690,8 +1686,7 @@ save_xjt_image (const gchar *filename,
/* create temporary directory */
l_dirname = gimp_temp_name (".tmpdir");
l_prop_file = g_strdup_printf ("%s%cPRP", l_dirname, G_DIR_SEPARATOR);
l_mode_dir = 0777;
if (mkdir (l_dirname, l_mode_dir) != 0)
if (g_mkdir (l_dirname, 0777) != 0)
{
g_message (_("Could not create working folder '%s': %s"),
gimp_filename_to_utf8 (l_dirname), g_strerror (errno));
@ -1699,7 +1694,7 @@ save_xjt_image (const gchar *filename,
}
/* create property file PRP */
l_fp_prp = fopen (l_prop_file, "w");
l_fp_prp = g_fopen (l_prop_file, "w");
if (l_fp_prp == NULL)
{
g_message (_("Could not open '%s' for writing: %s"),
@ -3282,7 +3277,6 @@ load_xjt_image (const gchar *filename)
gchar *l_prop_file;
gchar *l_jpg_file;
gchar *l_cmd;
mode_t l_mode_dir;
gint32 *l_layers_list;
gint32 *l_channels_list;
@ -3318,8 +3312,8 @@ load_xjt_image (const gchar *filename)
/* create temporary directory */
l_dirname = gimp_temp_name (".tmpdir");
l_prop_file = g_strdup_printf("%s%cPRP", l_dirname, G_DIR_SEPARATOR);
l_mode_dir = 0777;
if(mkdir(l_dirname, l_mode_dir) != 0)
if(g_mkdir(l_dirname, 0777) != 0)
{
g_message (_("Could not create working folder '%s': %s"),
gimp_filename_to_utf8 (l_dirname), g_strerror (errno));