fixed a stupid type I introduced myself

--Sven
This commit is contained in:
Sven Neumann 1999-10-21 00:11:37 +00:00
parent 0d80c0c0da
commit 28205e6162
2 changed files with 53 additions and 49 deletions

View File

@ -1,3 +1,8 @@
Thu Oct 21 02:08:36 MEST 1999 Sven Neumann <sven@gimp.org>
* plug-ins/common/xpm.c: fixed a stupid cut'n'paste error I've
introduced
Wed Oct 20 15:33:49 PDT 1999 Manish Singh <yosh@gimp.org> Wed Oct 20 15:33:49 PDT 1999 Manish Singh <yosh@gimp.org>
* plug-ins/common/psp.c: make it compile * plug-ins/common/psp.c: make it compile

View File

@ -226,7 +226,7 @@ run (char *name,
init_gtk (); init_gtk ();
image_ID = param[1].data.d_int32; image_ID = param[1].data.d_int32;
drawable_ID = param[1].data.d_int32; drawable_ID = param[2].data.d_int32;
/* eventually export the image */ /* eventually export the image */
switch (run_mode) switch (run_mode)
@ -471,21 +471,20 @@ parse_image (gint32 image_ID,
g_free(buf); g_free(buf);
} }
gimp_drawable_detach (drawable); gimp_drawable_detach (drawable);
} }
guint rgbhash (rgbkey *c) guint rgbhash (rgbkey *c)
{ {
return ((guint)c->r) ^ ((guint)c->g) ^ ((guint)c->b); return ((guint)c->r) ^ ((guint)c->g) ^ ((guint)c->b);
} }
guint compare (rgbkey *c1, guint compare (rgbkey *c1,
rgbkey *c2) rgbkey *c2)
{ {
return (c1->r == c2->r)&&(c1->g == c2->g)&&(c1->b == c2->b); return (c1->r == c2->r)&&(c1->g == c2->g)&&(c1->b == c2->b);
} }
@ -493,45 +492,45 @@ void set_XpmImage (XpmColor *array,
guint index, guint index,
char *colorstring) char *colorstring)
{ {
char *p; char *p;
int i, charnum, indtemp; int i, charnum, indtemp;
indtemp=index; indtemp=index;
array[index].string = p = g_new(char, cpp+1); array[index].string = p = g_new(char, cpp+1);
/*convert the index number to base sizeof(linenoise)-1 */ /*convert the index number to base sizeof(linenoise)-1 */
for(i=0; i<cpp; ++i) for(i=0; i<cpp; ++i)
{ {
charnum = indtemp%(sizeof(linenoise)-1); charnum = indtemp%(sizeof(linenoise)-1);
indtemp = indtemp / (sizeof (linenoise)-1); indtemp = indtemp / (sizeof (linenoise)-1);
*p++=linenoise[charnum]; *p++=linenoise[charnum];
} }
/* *p++=linenoise[indtemp]; */ /* *p++=linenoise[indtemp]; */
*p='\0'; /* C and its stupid null-terminated strings...*/ *p='\0'; /* C and its stupid null-terminated strings...*/
array[index].symbolic = NULL;
array[index].symbolic = NULL; array[index].m_color = NULL;
array[index].m_color = NULL; array[index].g4_color = NULL;
array[index].g4_color = NULL; if (color)
if (color) {
{ array[index].g_color = NULL;
array[index].g_color = NULL; array[index].c_color = colorstring;
array[index].c_color = colorstring; } else {
} else { array[index].c_color = NULL;
array[index].c_color = NULL; array[index].g_color = colorstring;
array[index].g_color = colorstring; }
}
} }
void create_colormap_from_hash (gpointer gkey, void create_colormap_from_hash (gpointer gkey,
gpointer value, gpointer value,
gpointer user_data) gpointer user_data)
{ {
rgbkey *key = gkey; rgbkey *key = gkey;
char *string = g_new(char, 8); char *string = g_new(char, 8);
sprintf(string, "#%02X%02X%02X", (int)key->r, (int)key->g, (int)key->b);
set_XpmImage(user_data, *((int *) value), string); sprintf(string, "#%02X%02X%02X", (int)key->r, (int)key->g, (int)key->b);
set_XpmImage(user_data, *((int *) value), string);
} }
static gint static gint
@ -539,18 +538,18 @@ save_image (char *filename,
gint32 image_ID, gint32 image_ID,
gint32 drawable_ID) gint32 drawable_ID)
{ {
GDrawable *drawable; GDrawable *drawable;
int width; int width;
int height; int height;
int alpha; int alpha;
int ncolors=1; int ncolors=1;
int *indexno; int *indexno;
int indexed; int indexed;
XpmColor *colormap; XpmColor *colormap;
XpmImage *image; XpmImage *image;
guint *ibuff = NULL; guint *ibuff = NULL;
/*guint *mbuff = NULL;*/ /*guint *mbuff = NULL;*/
GPixelRgn pixel_rgn; GPixelRgn pixel_rgn;
@ -642,6 +641,7 @@ save_image (char *filename,
/* allocate a pixel region to work with */ /* allocate a pixel region to work with */
if ((buffer = g_new(guchar, gimp_tile_height()*width*drawable->bpp)) == NULL) if ((buffer = g_new(guchar, gimp_tile_height()*width*drawable->bpp)) == NULL)
return 0; return 0;
gimp_pixel_rgn_init (&pixel_rgn, drawable, gimp_pixel_rgn_init (&pixel_rgn, drawable,
0, 0, 0, 0,
width, height, width, height,
@ -695,8 +695,7 @@ save_image (char *filename,
/* kick the progress bar */ /* kick the progress bar */
gimp_progress_update ((double) (i+j) / (double) height); gimp_progress_update ((double) (i+j) / (double) height);
} }
} }
g_free(buffer); g_free(buffer);