Commit 7f6dd5bf authored by Michael Natterer's avatar Michael Natterer 😴 Committed by Michael Natterer

plug-ins/common/bz2.c plug-ins/common/gz.c plug-ins/common/hrz.c

2004-01-19  Michael Natterer  <mitch@gimp.org>

	* plug-ins/common/bz2.c
	* plug-ins/common/gz.c
	* plug-ins/common/hrz.c
	* plug-ins/common/pnm.c
	* plug-ins/sgi/sgi.c: marked some forgotten strings for
	translation and use translated standard file error messages (no
	new strings introduced), some indentation and cleanup.
parent 4baf3612
2004-01-19 Michael Natterer <mitch@gimp.org>
* plug-ins/common/bz2.c
* plug-ins/common/gz.c
* plug-ins/common/hrz.c
* plug-ins/common/pnm.c
* plug-ins/sgi/sgi.c: marked some forgotten strings for
translation and use translated standard file error messages (no
new strings introduced), some indentation and cleanup.
2004-01-19 Michael Natterer <mitch@gimp.org>
* plug-ins/bmp/bmpread.c
......@@ -247,7 +247,8 @@ save_image (const gchar *filename,
{
if (!(f = fopen (filename, "w")))
{
g_message ("fopen() failed: %s", g_strerror (errno));
g_message (_("Could not open '%s' for writing: %s"),
gimp_filename_to_utf8 (filename), g_strerror (errno));
g_free (tmpname);
_exit(127);
}
......@@ -316,12 +317,14 @@ load_image (const gchar *filename,
else if (pid == 0) /* child process */
{
FILE *f;
if (!(f = fopen (tmpname,"w")))
{
g_message ("fopen() failed: %s", g_strerror (errno));
g_free (tmpname);
_exit (127);
}
if (!(f = fopen (tmpname,"w")))
{
g_message (_("Could not open '%s' for writing: %s"),
gimp_filename_to_utf8 (tmpname), g_strerror (errno));
g_free (tmpname);
_exit (127);
}
/* make stdout for this child process be the temp file */
if (-1 == dup2 (fileno (f), fileno (stdout)))
......
......@@ -285,7 +285,7 @@ save_image (const gchar *filename,
image_ID,
drawable_ID,
tmpname,
tmpname) && valid_file (tmpname)) )
tmpname) && valid_file (tmpname)))
{
unlink (tmpname);
g_free (tmpname);
......@@ -302,10 +302,10 @@ save_image (const gchar *filename,
}
else if (pid == 0)
{
if (!(f = fopen (filename, "w")))
{
g_message ("fopen() failed: %s", g_strerror (errno));
g_message (_("Could not open '%s' for writing: %s"),
gimp_filename_to_utf8 (filename), g_strerror (errno));
g_free (tmpname);
_exit (127);
}
......@@ -410,12 +410,14 @@ load_image (const gchar *filename,
else if (pid == 0) /* child process */
{
FILE *f;
if (!(f = fopen (tmpname, "w")))
{
g_message ("fopen() failed: %s", g_strerror (errno));
g_free (tmpname);
_exit(127);
}
if (! (f = fopen (tmpname, "w")))
{
g_message (_("Could not open '%s' for writing: %s"),
gimp_filename_to_utf8 (tmpname), g_strerror (errno));
g_free (tmpname);
_exit(127);
}
/* make stdout for this child process be the temp file */
if (-1 == dup2 (fileno (f), fileno (stdout)))
......
......@@ -285,7 +285,7 @@ save_image (const gchar *filename,
image_ID,
drawable_ID,
tmpname,
tmpname) && valid_file (tmpname)) )
tmpname) && valid_file (tmpname)))
{
unlink (tmpname);
g_free (tmpname);
......@@ -302,10 +302,10 @@ save_image (const gchar *filename,
}
else if (pid == 0)
{
if (!(f = fopen (filename, "w")))
{
g_message ("fopen() failed: %s", g_strerror (errno));
g_message (_("Could not open '%s' for writing: %s"),
gimp_filename_to_utf8 (filename), g_strerror (errno));
g_free (tmpname);
_exit (127);
}
......@@ -410,12 +410,14 @@ load_image (const gchar *filename,
else if (pid == 0) /* child process */
{
FILE *f;
if (!(f = fopen (tmpname, "w")))
{
g_message ("fopen() failed: %s", g_strerror (errno));
g_free (tmpname);
_exit(127);
}
if (! (f = fopen (tmpname, "w")))
{
g_message (_("Could not open '%s' for writing: %s"),
gimp_filename_to_utf8 (tmpname), g_strerror (errno));
g_free (tmpname);
_exit(127);
}
/* make stdout for this child process be the temp file */
if (-1 == dup2 (fileno (f), fileno (stdout)))
......
......@@ -86,11 +86,10 @@ static gint save_image (const gchar *filename,
gint32 drawable_ID);
/*
static gint save_dialog (void);
static void save_ok_callback (GtkWidget *widget,
gpointer data);
static gboolean save_dialog (void);
*/
#define hrzscanner_eof(s) ((s)->eof)
#define hrzscanner_fp(s) ((s)->fp)
......@@ -401,13 +400,15 @@ static void
saverow (FILE *fp,
guchar *data)
{
gint loop = 256*3;
gint loop = 256 * 3;
guchar *walk = data;
while (loop--)
{
*walk = (*walk >> 2);
walk++;
}
fwrite (data, 1, 256 * 3, fp);
}
......@@ -417,17 +418,17 @@ save_image (const gchar *filename,
gint32 image_ID,
gint32 drawable_ID)
{
GimpPixelRgn pixel_rgn;
GimpDrawable *drawable;
GimpImageType drawable_type;
guchar *data;
guchar *d; /* FIX */
guchar *rowbuf;
gchar *temp;
gint np = 3;
gint xres, yres;
gint ypos, yend;
FILE *fp;
GimpPixelRgn pixel_rgn;
GimpDrawable *drawable;
GimpImageType drawable_type;
guchar *data;
guchar *d; /* FIX */
guchar *rowbuf;
gchar *temp;
gint np = 3;
gint xres, yres;
gint ypos, yend;
FILE *fp;
/* initialize */
......@@ -441,16 +442,7 @@ save_image (const gchar *filename,
/* Make sure we're not saving an image with an alpha channel */
if (gimp_drawable_has_alpha (drawable_ID))
{
/* gimp_message ("HRZ save cannot handle images with alpha channels."); */
return FALSE;
}
/* open the file */
fp = fopen (filename, "wb");
if (fp == NULL)
{
g_message ("Could not open '%s' for writing: %s",
gimp_filename_to_utf8 (filename), g_strerror (errno));
g_message (_("Cannot save images with alpha channel."));
return FALSE;
}
......@@ -462,12 +454,22 @@ save_image (const gchar *filename,
g_message (_("Image must be 256x240"));
return FALSE;
}
if (drawable_type == GIMP_INDEXED_IMAGE)
{
g_message (_("Image must be RGB or GRAY"));
return FALSE;
}
/* open the file */
fp = fopen (filename, "wb");
if (fp == NULL)
{
g_message (_("Could not open '%s' for writing: %s"),
gimp_filename_to_utf8 (filename), g_strerror (errno));
return FALSE;
}
temp = g_strdup_printf (_("Saving '%s'..."),
gimp_filename_to_utf8 (filename));
gimp_progress_init (temp);
......@@ -495,7 +497,7 @@ save_image (const gchar *filename,
d += xres * np;
if (!(ypos & 0x0f))
gimp_progress_update ((double)ypos / 240.0 );
gimp_progress_update ((double) ypos / 240.0);
}
/* close the file */
......@@ -511,39 +513,27 @@ save_image (const gchar *filename,
/*********** Save dialog ************/
/*
static gint
static gboolean
save_dialog (void)
{
GtkWidget *dlg;
gboolean run;
dlg = gimp_dialog_new (_("Save as HRZ"), "hrz",
gimp_standard_help_func, "filters/hrz.html",
GTK_WIN_POS_MOUSE,
FALSE, TRUE, FALSE,
NULL, 0,
gimp_standard_help_func, "filters/hrz.html",
GTK_STOCK_CANCEL, gtk_widget_destroy,
NULL, 1, NULL, FALSE, TRUE,
GTK_STOCK_OK, save_ok_callback,
NULL, NULL, NULL, TRUE, FALSE,
GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
GTK_STOCK_OK, GTK_RESPONSE_OK,
NULL);
g_signal_connect (dlg, "destroy",
G_CALLBACK (gtk_main_quit),
NULL);
gtk_widget_show (dlg);
gtk_main ();
gdk_flush ();
run = (gimp_dialog_run (GIMP_DIALOG (dlg)) == GTK_RESPONSE_OK);
return psint.run;
}
static void
save_ok_callback (GtkWidget *widget,
gpointer data)
{
psint.run = TRUE;
gtk_widget_destroy (dlg);
gtk_widget_destroy (GTK_WIDGET (data));
return run;
}
*/
......@@ -768,7 +768,7 @@ save_image (const gchar *filename,
if (fd == -1)
{
g_message ("Could not open '%s' for writing: %s",
g_message (_("Could not open '%s' for writing: %s"),
gimp_filename_to_utf8 (filename), g_strerror (errno));
return FALSE;
}
......
......@@ -314,8 +314,8 @@ load_image (const gchar *filename) /* I - File to load */
sgip = sgiOpen ((char *) filename, SGI_READ, 0, 0, 0, 0, 0);
if (sgip == NULL)
{
g_message ("Could not open '%s' for reading.",
gimp_filename_to_utf8 (filename));
g_message (_("Could not open '%s' for reading."),
gimp_filename_to_utf8 (filename));
return -1;
};
......@@ -382,15 +382,15 @@ load_image (const gchar *filename) /* I - File to load */
* Temporary buffers...
*/
tile_height = gimp_tile_height();
pixel = g_new(guchar, tile_height * sgip->xsize * sgip->zsize);
pixels = g_new(guchar *, tile_height);
tile_height = gimp_tile_height ();
pixel = g_new (guchar, tile_height * sgip->xsize * sgip->zsize);
pixels = g_new (guchar *, tile_height);
for (i = 0; i < tile_height; i ++)
pixels[i] = pixel + sgip->xsize * sgip->zsize * i;
rows = g_new(unsigned short *, sgip->zsize);
rows[0] = g_new(unsigned short, sgip->xsize * sgip->zsize);
rows = g_new (unsigned short *, sgip->zsize);
rows[0] = g_new (unsigned short, sgip->xsize * sgip->zsize);
for (i = 1; i < sgip->zsize; i ++)
rows[i] = rows[0] + i * sgip->xsize;
......@@ -409,11 +409,11 @@ load_image (const gchar *filename) /* I - File to load */
0, y - count, drawable->width, count);
count = 0;
gimp_progress_update((double)y / (double)sgip->ysize);
gimp_progress_update ((double) y / (double) sgip->ysize);
}
for (i = 0; i < sgip->zsize; i ++)
if (sgiGetRow(sgip, rows[i], sgip->ysize - 1 - y, i) < 0)
if (sgiGetRow (sgip, rows[i], sgip->ysize - 1 - y, i) < 0)
printf("sgiGetRow(sgip, rows[i], %d, %d) failed!\n",
sgip->ysize - 1 - y, i);
......@@ -464,7 +464,7 @@ load_image (const gchar *filename) /* I - File to load */
gimp_drawable_flush (drawable);
gimp_drawable_detach (drawable);
return (image);
return image;
}
......@@ -543,9 +543,9 @@ save_image (const gchar *filename,
* Allocate memory for "tile_height" rows...
*/
tile_height = gimp_tile_height();
pixel = g_new(guchar, tile_height * drawable->width * zsize);
pixels = g_new(guchar *, tile_height);
tile_height = gimp_tile_height ();
pixel = g_new (guchar, tile_height * drawable->width * zsize);
pixels = g_new (guchar *, tile_height);
for (i = 0; i < tile_height; i ++)
pixels[i]= pixel + drawable->width * zsize * i;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment