libgimp: use enums instead of gint where appropriate

pnm plug-in:  got rid of a few compiler warnings


--Sven
This commit is contained in:
Sven Neumann 1999-12-27 12:02:07 +00:00
parent b8e03bd1c7
commit 410e2e9995
9 changed files with 120 additions and 103 deletions

View file

@ -1,3 +1,12 @@
Mon Dec 27 12:57:52 CET 1999 Sven Neumann <sven@gimp.org>
* libgimp/gimp.h
* libgimp/gimpdrawable.c
* libgimp/gimpimage.c
* libgimp/gimplayer.c: use enums instead of gint where appropriate
* plug-ins/common/pnm.c: got rid of a few compiler warnings
Sat Dec 25 23:15:46 PST 1999 Manish Singh <yosh@gimp.org>
* Makefile.am: added spec file to EXTRA_DIST

View file

@ -1,21 +1,22 @@
/* LIBGIMP - The GIMP Library
* Copyright (C) 1995-1997 Peter Mattis and Spencer Kimball
/* LIBGIMP - The GIMP Library
* Copyright (C) 1995-1997 Peter Mattis and Spencer Kimball
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library 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
* version 2 of the License, or (at your option) any later version.
*
* This library 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
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*/
*/
#ifndef __GIMP_H__
#define __GIMP_H__
@ -454,7 +455,7 @@ void gimp_image_lower_channel (gint32 image_ID,
void gimp_image_lower_layer (gint32 image_ID,
gint32 layer_ID);
gint32 gimp_image_merge_visible_layers (gint32 image_ID,
gint merge_type);
GimpMergeType merge_type);
gint32 gimp_image_pick_correlate_layer (gint32 image_ID,
gint x,
gint y);
@ -534,9 +535,9 @@ guchar * gimp_image_get_thumbnail_data (gint32 image_ID,
gint *bytes);
void gimp_image_convert_rgb (gint32 image_ID);
void gimp_image_convert_grayscale (gint32 image_ID);
void gimp_image_convert_indexed (gint32 image_ID,
gint dither_type,
gint palette_type,
void gimp_image_convert_indexed (gint32 image_ID,
GimpConvertDitherType dither_type,
GimpConvertPaletteType palette_type,
gint num_colors,
gint alpha_dither,
gint remove_unused,
@ -585,10 +586,10 @@ void gimp_layer_delete (gint32 layer_ID);
guint gimp_layer_width (gint32 layer_ID);
guint gimp_layer_height (gint32 layer_ID);
guint gimp_layer_bpp (gint32 layer_ID);
GDrawableType gimp_layer_type (gint32 layer_ID);
GDrawableType gimp_layer_type (gint32 layer_ID);
void gimp_layer_add_alpha (gint32 layer_ID);
gint32 gimp_layer_create_mask (gint32 layer_ID,
gint mask_type);
GimpAddMaskType mask_type);
void gimp_layer_resize (gint32 layer_ID,
guint new_width,
guint new_height,
@ -711,7 +712,7 @@ void gimp_drawable_offsets (gint32 drawable_ID,
gint *offset_x,
gint *offset_y);
void gimp_drawable_fill (gint32 drawable_ID,
gint fill_type);
GimpFillType fill_type);
void gimp_drawable_set_name (gint32 drawable_ID,
char *name);
void gimp_drawable_set_visible (gint32 drawable_ID,

View file

@ -464,8 +464,8 @@ gimp_drawable_offsets (gint32 drawable_ID,
}
void
gimp_drawable_fill (gint32 drawable_ID,
gint fill_type)
gimp_drawable_fill (gint32 drawable_ID,
GimpFillType fill_type)
{
GParam *return_vals;
int nreturn_vals;

View file

@ -464,8 +464,8 @@ gimp_drawable_offsets (gint32 drawable_ID,
}
void
gimp_drawable_fill (gint32 drawable_ID,
gint fill_type)
gimp_drawable_fill (gint32 drawable_ID,
GimpFillType fill_type)
{
GParam *return_vals;
int nreturn_vals;

View file

@ -507,8 +507,8 @@ gimp_image_lower_layer (gint32 image_ID,
}
gint32
gimp_image_merge_visible_layers (gint32 image_ID,
gint merge_type)
gimp_image_merge_visible_layers (gint32 image_ID,
GimpMergeType merge_type)
{
GParam *return_vals;
int nreturn_vals;
@ -1250,13 +1250,13 @@ gimp_image_convert_grayscale (gint32 image_ID)
}
void
gimp_image_convert_indexed (gint32 image_ID,
gint dither_type,
gint palette_type,
gint num_colors,
gint alpha_dither,
gint remove_unused,
gchar *palette)
gimp_image_convert_indexed (gint32 image_ID,
GimpConvertDitherType dither_type,
GimpConvertPaletteType palette_type,
gint num_colors,
gint alpha_dither,
gint remove_unused,
gchar *palette)
{
GParam *return_vals;
int nreturn_vals;

View file

@ -507,8 +507,8 @@ gimp_image_lower_layer (gint32 image_ID,
}
gint32
gimp_image_merge_visible_layers (gint32 image_ID,
gint merge_type)
gimp_image_merge_visible_layers (gint32 image_ID,
GimpMergeType merge_type)
{
GParam *return_vals;
int nreturn_vals;
@ -1250,13 +1250,13 @@ gimp_image_convert_grayscale (gint32 image_ID)
}
void
gimp_image_convert_indexed (gint32 image_ID,
gint dither_type,
gint palette_type,
gint num_colors,
gint alpha_dither,
gint remove_unused,
gchar *palette)
gimp_image_convert_indexed (gint32 image_ID,
GimpConvertDitherType dither_type,
GimpConvertPaletteType palette_type,
gint num_colors,
gint alpha_dither,
gint remove_unused,
gchar *palette)
{
GParam *return_vals;
int nreturn_vals;

View file

@ -1,21 +1,22 @@
/* LIBGIMP - The GIMP Library
/* LIBGIMP - The GIMP Library
* Copyright (C) 1995-1997 Peter Mattis and Spencer Kimball
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library 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
* version 2 of the License, or (at your option) any later version.
*
* This library 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
* Library General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*/
*/
#include "gimp.h"
@ -126,8 +127,8 @@ gimp_layer_add_alpha (gint32 layer_ID)
}
gint32
gimp_layer_create_mask (gint32 layer_ID,
gint mask_type)
gimp_layer_create_mask (gint32 layer_ID,
GimpAddMaskType mask_type)
{
GParam *return_vals;
int nreturn_vals;

View file

@ -1,21 +1,22 @@
/* LIBGIMP - The GIMP Library
/* LIBGIMP - The GIMP Library
* Copyright (C) 1995-1997 Peter Mattis and Spencer Kimball
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library 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
* version 2 of the License, or (at your option) any later version.
*
* This library 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
* Library General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*/
*/
#include "gimp.h"
@ -126,8 +127,8 @@ gimp_layer_add_alpha (gint32 layer_ID)
}
gint32
gimp_layer_create_mask (gint32 layer_ID,
gint mask_type)
gimp_layer_create_mask (gint32 layer_ID,
GimpAddMaskType mask_type)
{
GParam *return_vals;
int nreturn_vals;

View file

@ -630,6 +630,7 @@ pnm_load_rawpbm (PNMScanner *scan,
CHECK_FOR_ERROR((rowlen != read(fd, buf, rowlen)),
info->jmpbuf, "pnm filter: error reading file\n");
bufpos = 0;
curbyte = buf[0];
for (x = 0; x < info->xres; x++)
{
@ -730,10 +731,10 @@ save_image (char *filename,
char *rowbuf;
char buf[BUFLEN];
char *temp;
int np;
int np = 0;
int xres, yres;
int ypos, yend;
int rowbufsize;
int rowbufsize = 0;
int fd;
drawable = gimp_drawable_get (drawable_ID);
@ -765,52 +766,54 @@ save_image (char *filename,
/* write out magic number */
if (psvals.raw == FALSE)
{
if (drawable_type == GRAY_IMAGE)
{
write(fd, "P2\n", 3);
np = 1;
rowbufsize = xres * 4;
saverow = pnmsaverow_ascii;
}
else if (drawable_type == RGB_IMAGE)
{
write(fd, "P3\n", 3);
np = 3;
rowbufsize = xres * 12;
saverow = pnmsaverow_ascii;
}
else if (drawable_type == INDEXED_IMAGE)
{
write(fd, "P3\n", 3);
np = 1;
rowbufsize = xres * 12;
saverow = pnmsaverow_ascii_indexed;
}
}
switch (drawable_type)
{
case GRAY_IMAGE:
write(fd, "P2\n", 3);
np = 1;
rowbufsize = xres * 4;
saverow = pnmsaverow_ascii;
break;
case RGB_IMAGE:
write(fd, "P3\n", 3);
np = 3;
rowbufsize = xres * 12;
saverow = pnmsaverow_ascii;
break;
case INDEXED_IMAGE:
write(fd, "P3\n", 3);
np = 1;
rowbufsize = xres * 12;
saverow = pnmsaverow_ascii_indexed;
break;
default:
g_warning ("pnm: unknown drawable_type\n");
return FALSE;
}
else if (psvals.raw == TRUE)
{
if (drawable_type == GRAY_IMAGE)
{
write(fd, "P5\n", 3);
np = 1;
rowbufsize = xres;
saverow = pnmsaverow_raw;
}
else if (drawable_type == RGB_IMAGE)
{
write(fd, "P6\n", 3);
np = 3;
rowbufsize = xres * 3;
saverow = pnmsaverow_raw;
}
else if (drawable_type == INDEXED_IMAGE)
{
write(fd, "P6\n", 3);
np = 1;
rowbufsize = xres * 3;
saverow = pnmsaverow_raw_indexed;
}
switch (drawable_type)
{
case GRAY_IMAGE:
write(fd, "P5\n", 3);
np = 1;
rowbufsize = xres;
saverow = pnmsaverow_raw;
break;
case RGB_IMAGE:
write(fd, "P6\n", 3);
np = 3;
rowbufsize = xres * 3;
saverow = pnmsaverow_raw;
break;
case INDEXED_IMAGE:
write(fd, "P6\n", 3);
np = 1;
rowbufsize = xres * 3;
saverow = pnmsaverow_raw_indexed;
break;
default:
g_warning ("pnm: unknown drawable_type\n");
return FALSE;
}
if (drawable_type == INDEXED_IMAGE)
@ -849,9 +852,11 @@ save_image (char *filename,
rowinfo.xres = xres;
rowinfo.np = np;
d = NULL; /* only to please the compiler */
/* Write the body out */
for (ypos = 0; ypos < yres; ypos++)
{
{
if ((ypos % gimp_tile_height ()) == 0)
{
yend = ypos + gimp_tile_height ();