Commit 2a35ff7f authored by Sven Neumann's avatar Sven Neumann Committed by Sven Neumann
Browse files

plug-ins/common/blur.c plug-ins/common/gifload.c plug-ins/common/gih.c

2003-07-03  Sven Neumann  <sven@gimp.org>

	* plug-ins/common/blur.c
	* plug-ins/common/gifload.c
	* plug-ins/common/gih.c
	* plug-ins/common/gqbist.c
	* plug-ins/common/jpeg.c
	* plug-ins/common/mapcolor.c
	* plug-ins/common/pcx.c
	* plug-ins/common/png.c
	* plug-ins/common/ps.c
	* plug-ins/common/psd.c
	* plug-ins/common/psp.c
	* plug-ins/common/randomize.c
	* plug-ins/common/sinus.c
	* plug-ins/common/snoise.c
	* plug-ins/common/tga.c
	* plug-ins/common/wmf.c
	* plug-ins/common/xbm.c
	* plug-ins/fp/fp.h
	* plug-ins/fp/fp_gdk.c
	* plug-ins/fp/fp_gtk.c
	* plug-ins/gfig/gfig.c
	* plug-ins/gflare/gflare.c
	* plug-ins/gimpressionist/brush.c
	* plug-ins/gimpressionist/paper.c
	* plug-ins/gimpressionist/ppmtool.c
	* plug-ins/gimpressionist/preview.c
	* plug-ins/ifscompose/ifscompose_utils.c
	* plug-ins/script-fu/script-fu-server.c
	* plug-ins/xjt/xjt.c: fixed some minor code issues found compiling
	with -pedantic.
parent 69a19e76
2003-07-03 Sven Neumann <sven@gimp.org>
* plug-ins/common/blur.c
* plug-ins/common/gifload.c
* plug-ins/common/gih.c
* plug-ins/common/gqbist.c
* plug-ins/common/jpeg.c
* plug-ins/common/mapcolor.c
* plug-ins/common/pcx.c
* plug-ins/common/png.c
* plug-ins/common/ps.c
* plug-ins/common/psd.c
* plug-ins/common/psp.c
* plug-ins/common/randomize.c
* plug-ins/common/sinus.c
* plug-ins/common/snoise.c
* plug-ins/common/tga.c
* plug-ins/common/wmf.c
* plug-ins/common/xbm.c
* plug-ins/fp/fp.h
* plug-ins/fp/fp_gdk.c
* plug-ins/fp/fp_gtk.c
* plug-ins/gfig/gfig.c
* plug-ins/gflare/gflare.c
* plug-ins/gimpressionist/brush.c
* plug-ins/gimpressionist/paper.c
* plug-ins/gimpressionist/ppmtool.c
* plug-ins/gimpressionist/preview.c
* plug-ins/ifscompose/ifscompose_utils.c
* plug-ins/script-fu/script-fu-server.c
* plug-ins/xjt/xjt.c: fixed some minor code issues found compiling
with -pedantic.
2003-07-03 Manish Singh <yosh@gimp.org>
 
* configure.in: remove gimp.spec stuff (leave gimp.spec.in in CVS
......@@ -9,6 +9,8 @@ development takes place on the road to the next stable release.
Overview of Changes in GIMP 1.3.17
==================================
- Support for comments in PNG files [Sven]
- Constified the libgimp API and adapted all plug-ins [Yosh, Sven]
- Cleaned up the brush/font/gradient/pattern selector API [Mitch]
- Support for patterns with alpha channel [Bolsh]
- Lots of bug fixes
......
......@@ -96,7 +96,7 @@ typedef struct
{
gdouble blur_pct; /* likelihood of randomization (as %age) */
gdouble blur_rcount; /* repeat count */
gint blur_seed; /* seed value for g_random_set_seed() function */
guint blur_seed; /* seed value for g_random_set_seed() function */
} BlurVals;
static BlurVals pivals =
......
......@@ -481,8 +481,8 @@ static int
DoExtension (FILE *fd,
int label)
{
static guchar buf[256];
char *str;
static gchar buf[256];
gchar *str;
switch (label)
{
......
......@@ -87,7 +87,7 @@
static struct
{
guint spacing;
guchar description[MAXDESCLEN+1];
gchar description[MAXDESCLEN+1];
} info =
/* Initialize to this, change if non-interactive later */
{
......@@ -595,8 +595,8 @@ gih_load_one_brush (gint fd,
0, 0, drawable->width, drawable->height,
TRUE, FALSE);
gimp_pixel_rgn_set_rect (&pixel_rgn, (guchar *) brush_buf,
0, 0, bh.width, bh.height);
gimp_pixel_rgn_set_rect (&pixel_rgn,
brush_buf, 0, 0, bh.width, bh.height);
if (image_type == GIMP_GRAY_IMAGE)
gimp_invert (layer_ID);
......
......@@ -251,7 +251,7 @@ optimize (ExpInfo *info)
static void
qbist (ExpInfo *info,
gchar *buffer,
guchar *buffer,
gint xp,
gint yp,
gint num,
......@@ -394,7 +394,7 @@ qbist (ExpInfo *info,
{
if (i < 3)
{
buffer[i] = (guint8) (((gfloat) accum[i] /
buffer[i] = (guchar) (((gfloat) accum[i] /
(gfloat) (oversampling * oversampling)) + 0.5);
}
else
......@@ -610,7 +610,7 @@ dialog_update_previews (GtkWidget *widget,
optimize (&info[(j + 5) % 9]);
for (i = 0; i < PREVIEW_SIZE; i++)
{
qbist (&info[(j + 5) % 9], (gchar *) buf,
qbist (&info[(j + 5) % 9], buf,
0, i, PREVIEW_SIZE, PREVIEW_SIZE, PREVIEW_SIZE, 3, 1);
gtk_preview_draw_row (GTK_PREVIEW (preview[j]), buf,
0, i, PREVIEW_SIZE);
......
......@@ -758,9 +758,7 @@ load_image (const gchar *filename,
#ifdef HAVE_EXIF
GimpParasite *exif_parasite = NULL;
ExifData *exif_data = NULL;
guchar *exif_buf = NULL;
guint exif_buf_len = 0;
ExifData *exif_data = NULL;
#endif
/* We set up the normal JPEG error routines. */
......@@ -1104,14 +1102,17 @@ load_image (const gchar *filename,
exif_data = exif_data_new_from_file (filename);
if (exif_data)
{
guchar *exif_buf;
guint exif_buf_len;
exif_data_save_data (exif_data, &exif_buf, &exif_buf_len);
exif_data_unref (exif_data);
exif_parasite = gimp_parasite_new ("jpeg-exif-data",
GIMP_PARASITE_PERSISTENT,
exif_buf_len, exif_buf);
g_free (exif_buf);
gimp_image_parasite_attach (image_ID, exif_parasite);
gimp_parasite_free (exif_parasite);
free (exif_buf);
}
#endif
......@@ -1244,11 +1245,6 @@ save_image (const gchar *filename,
gint rowstride, yend;
gint i, j;
#ifdef HAVE_EXIF
guchar *exif_buf;
guint exif_buf_len;
#endif
drawable = gimp_drawable_get (drawable_ID);
drawable_type = gimp_drawable_type (drawable_ID);
gimp_pixel_rgn_init (&pixel_rgn, drawable,
......@@ -1455,19 +1451,21 @@ save_image (const gchar *filename,
#ifdef HAVE_EXIF
if (exif_data)
{
guchar *exif_buf;
guint exif_buf_len;
exif_data_save_data (exif_data, &exif_buf, &exif_buf_len);
jpeg_write_marker (&cinfo, 0xe1, exif_buf, exif_buf_len);
g_free (exif_buf);
jpeg_write_marker (&cinfo, 0xe1,
exif_buf, exif_buf_len);
free (exif_buf);
}
#endif
/* Step 4.1: Write the comment out - pw */
if (image_comment && *image_comment)
{
jpeg_write_marker (&cinfo,
JPEG_COM,
image_comment,
strlen (image_comment));
jpeg_write_marker (&cinfo, JPEG_COM,
(guchar *) image_comment, strlen (image_comment));
}
/* Step 5: while (scan lines remain to be written) */
......
......@@ -733,7 +733,7 @@ color_mapping (GimpDrawable *drawable)
{
gint processed, total;
guint x, y, xmin, xmax, ymin, ymax;
gint x, y, xmin, xmax, ymin, ymax;
guint bpp = drawable->bpp;
guchar *src;
guchar *dest;
......
......@@ -127,22 +127,22 @@ static gint32 load_image (const gchar *filename);
static void load_1 (FILE *fp,
gint width,
gint height,
gchar *buffer,
guchar *buffer,
gint bytes);
static void load_4 (FILE *fp,
gint width,
gint height,
gchar *buffer,
guchar *buffer,
gint bytes);
static void load_8 (FILE *fp,
gint width,
gint height,
gchar *buffer,
guchar *buffer,
gint bytes);
static void load_24 (FILE *fp,
gint width,
gint height,
gchar *buffer,
guchar *buffer,
gint bytes);
static void readline (FILE *fp,
guchar *buffer,
......@@ -383,15 +383,14 @@ load_image (const gchar *filename)
}
static void
load_8 (FILE *fp,
gint width,
gint height,
gchar *buffer,
gint bytes)
load_8 (FILE *fp,
gint width,
gint height,
guchar *buffer,
gint bytes)
{
int row;
guchar *line;
line = (guchar *) g_malloc (bytes);
gint row;
guchar *line= g_new (guchar, bytes);
for (row = 0; row < height; buffer += width, ++row)
{
......@@ -404,15 +403,14 @@ load_8 (FILE *fp,
}
static void
load_24 (FILE *fp,
gint width,
gint height,
gchar *buffer,
gint bytes)
load_24 (FILE *fp,
gint width,
gint height,
guchar *buffer,
gint bytes)
{
int x, y, c;
guchar *line;
line = (guchar *) g_malloc (bytes * 3);
gint x, y, c;
guchar *line= g_new (guchar, bytes);
for (y = 0; y < height; buffer += width * 3, ++y)
{
......@@ -431,15 +429,14 @@ load_24 (FILE *fp,
}
static void
load_1 (FILE *fp,
gint width,
gint height,
gchar *buffer,
gint bytes)
load_1 (FILE *fp,
gint width,
gint height,
guchar *buffer,
gint bytes)
{
int x, y;
guchar *line;
line = (guchar *) g_malloc (bytes);
gint x, y;
guchar *line = g_new (guchar, bytes);
for (y = 0; y < height; buffer += width, ++y)
{
......@@ -458,15 +455,14 @@ load_1 (FILE *fp,
}
static void
load_4 (FILE *fp,
gint width,
gint height,
gchar *buffer,
gint bytes)
load_4 (FILE *fp,
gint width,
gint height,
guchar *buffer,
gint bytes)
{
int x, y, c;
guchar *line;
line= (guchar *) g_malloc (bytes);
gint x, y, c;
guchar *line= g_new (guchar, bytes);
for (y = 0; y < height; buffer += width, ++y)
{
......
......@@ -147,7 +147,7 @@ static int find_unused_ia_colour (guchar * pixels,
int *colors)
{
int i;
gboolean ix_used[256]; // max of 256 palette entries
gboolean ix_used[256];
gboolean trans_used = FALSE;
for (i = 0; i < *colors; i++)
......@@ -165,7 +165,7 @@ static int find_unused_ia_colour (guchar * pixels,
trans_used = TRUE;
}
// If there is no transparency, ignore alpha.
/* If there is no transparency, ignore alpha. */
if (trans_used == FALSE)
return -1;
......
......@@ -2214,7 +2214,7 @@ save_bw (FILE *ofp,
GimpDrawable *drawable;
GimpImageType drawable_type;
static char *hex = "0123456789abcdef";
int level2 = (psvals.level > 1);
gint level2 = (psvals.level > 1);
cmap = gimp_image_get_cmap (image_ID, &ncols);
......@@ -2223,13 +2223,14 @@ save_bw (FILE *ofp,
width = drawable->width;
height = drawable->height;
tile_height = gimp_tile_height ();
gimp_pixel_rgn_init (&pixel_rgn, drawable, 0, 0, width, height, FALSE, FALSE);
gimp_pixel_rgn_init (&pixel_rgn,
drawable, 0, 0, width, height, FALSE, FALSE);
/* allocate a buffer for retrieving information from the pixel region */
src = data = (guchar *)g_malloc (tile_height * width * drawable->bpp);
src = data = g_new (guchar, tile_height * width * drawable->bpp);
nbsl = (width+7)/8;
scanline = (char *)g_malloc (nbsl + 1);
hex_scanline = (char *)g_malloc ((nbsl + 1)*2);
scanline = g_new (guchar, nbsl + 1);
hex_scanline = g_new (guchar, (nbsl + 1) * 2);
/* Set up transformation in PostScript */
save_ps_setup (ofp, drawable_ID, width, height, 1);
......@@ -2244,7 +2245,7 @@ save_bw (FILE *ofp,
fprintf (ofp,"currentfile /ASCII85Decode filter /RunLengthDecode filter\n");
ascii85_init ();
/* Allocate buffer for packbits data. Worst case: Less than 1% increase */
packb = (guchar *)g_malloc (((nbsl+1) * 105)/100+2);
packb = g_new (guchar, ((nbsl+1) * 105) / 100 + 2);
}
ps_begin_data (ofp);
fprintf (ofp, "image\n");
......
......@@ -2214,7 +2214,7 @@ save_bw (FILE *ofp,
GimpDrawable *drawable;
GimpImageType drawable_type;
static char *hex = "0123456789abcdef";
int level2 = (psvals.level > 1);
gint level2 = (psvals.level > 1);
cmap = gimp_image_get_cmap (image_ID, &ncols);
......@@ -2223,13 +2223,14 @@ save_bw (FILE *ofp,
width = drawable->width;
height = drawable->height;
tile_height = gimp_tile_height ();
gimp_pixel_rgn_init (&pixel_rgn, drawable, 0, 0, width, height, FALSE, FALSE);
gimp_pixel_rgn_init (&pixel_rgn,
drawable, 0, 0, width, height, FALSE, FALSE);
/* allocate a buffer for retrieving information from the pixel region */
src = data = (guchar *)g_malloc (tile_height * width * drawable->bpp);
src = data = g_new (guchar, tile_height * width * drawable->bpp);
nbsl = (width+7)/8;
scanline = (char *)g_malloc (nbsl + 1);
hex_scanline = (char *)g_malloc ((nbsl + 1)*2);
scanline = g_new (guchar, nbsl + 1);
hex_scanline = g_new (guchar, (nbsl + 1) * 2);
/* Set up transformation in PostScript */
save_ps_setup (ofp, drawable_ID, width, height, 1);
......@@ -2244,7 +2245,7 @@ save_bw (FILE *ofp,
fprintf (ofp,"currentfile /ASCII85Decode filter /RunLengthDecode filter\n");
ascii85_init ();
/* Allocate buffer for packbits data. Worst case: Less than 1% increase */
packb = (guchar *)g_malloc (((nbsl+1) * 105)/100+2);
packb = g_new (guchar, ((nbsl+1) * 105) / 100 + 2);
}
ps_begin_data (ofp);
fprintf (ofp, "image\n");
......
......@@ -349,9 +349,9 @@ static const gchar *prog_name = "PSD";
static void unpack_pb_channel(FILE *fd, guchar *dst, gint32 unpackedlen,
guint32 *offset);
static void decode(long clen, long uclen, gchar *src, gchar *dst, int step);
static void decode(long clen, long uclen, guchar *src, guchar *dst, int step);
static void packbitsdecode(long *clenp, long uclen,
gchar *src, gchar *dst, int step);
guchar *src, guchar *dst, int step);
static void cmyk2rgb(guchar *src, guchar *destp,
long width, long height, int alpha);
static void cmykp2rgb(guchar *src, guchar *destp,
......@@ -366,7 +366,7 @@ static void xfread_interlaced(FILE *fd, guchar *buf, long len, gchar *why,
gint step);
static void read_whole_file(FILE *fd);
static void reshuffle_cmap(guchar *map256);
static guchar* getpascalstring(FILE *fd, gchar *why);
static gchar* getpascalstring(FILE *fd, gchar *why);
static gchar* getstring(size_t n, FILE * fd, gchar *why);
static void throwchunk(size_t n, FILE * fd, gchar *why);
static void dumpchunk(size_t n, FILE * fd, gchar *why);
......@@ -2186,7 +2186,7 @@ load_image (const gchar *name)
}
static void
decode(long clen, long uclen, char * src, char * dst, int step)
decode(long clen, long uclen, guchar *src, guchar* dst, int step)
{
gint i, j;
gint32 l;
......@@ -2222,7 +2222,7 @@ decode(long clen, long uclen, char * src, char * dst, int step)
* Decode a PackBits data stream.
*/
static void
packbitsdecode(long * clenp, long uclen, char * src, char * dst, int step)
packbitsdecode(long * clenp, long uclen, guchar *src, guchar *dst, int step)
{
gint n, b;
gint32 clen = *clenp;
......@@ -2356,7 +2356,7 @@ cmykp2rgb(unsigned char * src, unsigned char * dst,
int r, g, b, k;
int i, j;
long n;
char *rp, *gp, *bp, *kp, *ap;
guchar *rp, *gp, *bp, *kp, *ap;
n = width * height;
rp = src;
......@@ -2489,7 +2489,7 @@ getstring(size_t n, FILE * fd, gchar *why)
return tmpchunk; /* caller should free memory */
}
static guchar *
static gchar *
getpascalstring(FILE *fd, gchar *why)
{
guchar *tmpchunk;
......@@ -2507,7 +2507,7 @@ getpascalstring(FILE *fd, gchar *why)
xfread(fd, tmpchunk, len, why);
tmpchunk[len]=0;
return tmpchunk; /* caller should free memory */
return (gchar *) tmpchunk; /* caller should free memory */
}
static guchar
......
......@@ -1052,7 +1052,7 @@ read_layer_block (FILE *f,
long block_start, sub_block_start, channel_start;
gint sub_id;
guint32 sub_init_len, sub_total_len;
guchar *name;
gchar *name;
guint16 namelen;
guchar type, opacity, blend_mode, visibility, transparency_protected;
guchar link_group_id, mask_linked, mask_disabled;
......
......@@ -130,7 +130,7 @@ typedef struct
{
gdouble rndm_pct; /* likelihood of randomization (as %age) */
gdouble rndm_rcount; /* repeat count */
gint rndm_seed; /* seed value for g_rand_set_seed() function */
guint rndm_seed; /* seed value for g_rand_set_seed() function */
} RandomizeVals;
static RandomizeVals pivals =
......
......@@ -50,7 +50,7 @@
pixel[2] = header_data_cmap[(unsigned char)data[0]][2]; \
data ++; }
static char header_data_cmap[256][3] = {
static const guchar header_data_cmap[256][3] = {
{210,214,212},
{187,178,183},
{184,185,180},
......@@ -308,7 +308,7 @@ static char header_data_cmap[256][3] = {
{255,255,255},
{255,255,255}
};
static char logo_data[] = {
static const guchar logo_data[] = {
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
......
......@@ -88,7 +88,7 @@ typedef struct
{
gint tilable;
gint turbulent;
gint seed;
guint seed;
gint detail;
gdouble xsize;
gdouble ysize;
......
......@@ -1012,7 +1012,7 @@ save_image (const gchar *filename,
guchar *pixels;
guchar *data;
guint num_colors;
gint num_colors;
guchar *gimp_cmap = NULL;
drawable = gimp_drawable_get (drawable_ID);
......
......@@ -1062,7 +1062,7 @@ load_image (const gchar *filename)
guint i, j, jj, k;
gint ix;
guchar *string;
gchar *string;
guint record_counter = 0;
GdkRectangle bbox;
gboolean have_bbox = FALSE;
......
......@@ -485,8 +485,8 @@ static gint
getval (gint c,
gint base)
{
static guchar *digits = "0123456789abcdefABCDEF";
gint val;
const gchar *digits = "0123456789abcdefABCDEF";
gint val;
/* Include uppercase hex digits. */
if (base == 16)
......@@ -952,7 +952,8 @@ save_image (const gchar *filename,
gboolean has_alpha;
gint bpp;
guchar *data, *cmap, *name_buf, *intfmt;
guchar *data, *cmap;
gchar *name_buf, *intfmt;
drawable = gimp_drawable_get (drawable_ID);
width = drawable->width;
......
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