summaryrefslogtreecommitdiff
path: root/lib/libXpm/src
diff options
context:
space:
mode:
authorMatthieu Herrb <matthieu@cvs.openbsd.org>2012-03-10 14:30:34 +0000
committerMatthieu Herrb <matthieu@cvs.openbsd.org>2012-03-10 14:30:34 +0000
commite858adc87bfe2328585974dfd9b2b08312efb884 (patch)
tree00dd99e1a1ea3d8d0c250b0b01e613b8eb4831e7 /lib/libXpm/src
parent147eb37143678240876ab6c86d148ac8d41160ab (diff)
Update to libXpm 3.5.10
Diffstat (limited to 'lib/libXpm/src')
-rw-r--r--lib/libXpm/src/Attrib.c2
-rw-r--r--lib/libXpm/src/CrBufFrI.c2
-rw-r--r--lib/libXpm/src/Makefile.in35
-rw-r--r--lib/libXpm/src/RdFToBuf.c12
-rw-r--r--lib/libXpm/src/WrFFrI.c13
-rw-r--r--lib/libXpm/src/XpmI.h31
-rw-r--r--lib/libXpm/src/amigax.c60
-rw-r--r--lib/libXpm/src/create.c28
-rw-r--r--lib/libXpm/src/data.c6
-rw-r--r--lib/libXpm/src/hashtab.c2
-rw-r--r--lib/libXpm/src/parse.c7
-rw-r--r--lib/libXpm/src/rgb.c2
-rw-r--r--lib/libXpm/src/scan.c30
-rw-r--r--lib/libXpm/src/simx.c18
14 files changed, 127 insertions, 121 deletions
diff --git a/lib/libXpm/src/Attrib.c b/lib/libXpm/src/Attrib.c
index cb304df1f..1b380470c 100644
--- a/lib/libXpm/src/Attrib.c
+++ b/lib/libXpm/src/Attrib.c
@@ -57,7 +57,7 @@ CreateOldColorTable(
XpmColor **colorTable, **color;
unsigned int a;
- if (ncolors >= UINT_MAX / sizeof(XpmColor *))
+ if (ncolors >= UINT_MAX / sizeof(XpmColor *))
return XpmNoMemory;
colorTable = (XpmColor **) XpmMalloc(ncolors * sizeof(XpmColor *));
diff --git a/lib/libXpm/src/CrBufFrI.c b/lib/libXpm/src/CrBufFrI.c
index 113a45c1e..398c645fc 100644
--- a/lib/libXpm/src/CrBufFrI.c
+++ b/lib/libXpm/src/CrBufFrI.c
@@ -214,7 +214,7 @@ XpmCreateBufferFromXpmImage(
}
ErrorStatus = WriteColors(&ptr, &ptr_size, &used_size,
image->colorTable, image->ncolors, image->cpp);
-
+
if (ErrorStatus != XpmSuccess)
RETURN(ErrorStatus);
diff --git a/lib/libXpm/src/Makefile.in b/lib/libXpm/src/Makefile.in
index 0f6546907..577eca457 100644
--- a/lib/libXpm/src/Makefile.in
+++ b/lib/libXpm/src/Makefile.in
@@ -25,9 +25,9 @@ pkgincludedir = $(includedir)/@PACKAGE@
top_builddir = ..
am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
INSTALL = @INSTALL@
-install_sh_DATA = $(install_sh) -c -m 644
-install_sh_PROGRAM = $(install_sh) -c
-install_sh_SCRIPT = $(install_sh) -c
+install_sh_DATA = ${SHELL} $(install_sh) -c -m 644
+install_sh_PROGRAM = ${SHELL} $(install_sh) -c
+install_sh_SCRIPT = ${SHELL} $(install_sh) -c
INSTALL_HEADER = $(INSTALL_DATA)
transform = $(program_transform_name)
NORMAL_INSTALL = :
@@ -42,7 +42,9 @@ subdir = src
DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
am__aclocal_m4_deps = $(top_srcdir)/m4/ax_define_dir.m4 \
- $(top_srcdir)/configure.ac
+ $(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/ltoptions.m4 \
+ $(top_srcdir)/m4/ltsugar.m4 $(top_srcdir)/m4/ltversion.m4 \
+ $(top_srcdir)/m4/lt~obsolete.m4 $(top_srcdir)/configure.ac
am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
$(ACLOCAL_M4)
mkinstalldirs = $(SHELL) $(install_sh) -d
@@ -96,6 +98,7 @@ AUTOCONF = @AUTOCONF@
AUTOHEADER = @AUTOHEADER@
AUTOMAKE = @AUTOMAKE@
AWK = @AWK@
+BASE_CFLAGS = @BASE_CFLAGS@
BUILD_SXPM_FALSE = @BUILD_SXPM_FALSE@
BUILD_SXPM_TRUE = @BUILD_SXPM_TRUE@
CC = @CC@
@@ -105,24 +108,20 @@ CHANGELOG_CMD = @CHANGELOG_CMD@
CPP = @CPP@
CPPFLAGS = @CPPFLAGS@
CWARNFLAGS = @CWARNFLAGS@
-CXX = @CXX@
-CXXCPP = @CXXCPP@
-CXXDEPMODE = @CXXDEPMODE@
-CXXFLAGS = @CXXFLAGS@
CYGPATH_W = @CYGPATH_W@
DEFS = @DEFS@
DEPDIR = @DEPDIR@
+DLLTOOL = @DLLTOOL@
DRIVER_MAN_DIR = @DRIVER_MAN_DIR@
DRIVER_MAN_SUFFIX = @DRIVER_MAN_SUFFIX@
DSYMUTIL = @DSYMUTIL@
-ECHO = @ECHO@
+DUMPBIN = @DUMPBIN@
ECHO_C = @ECHO_C@
ECHO_N = @ECHO_N@
ECHO_T = @ECHO_T@
EGREP = @EGREP@
EXEEXT = @EXEEXT@
-F77 = @F77@
-FFLAGS = @FFLAGS@
+FGREP = @FGREP@
FILE_MAN_DIR = @FILE_MAN_DIR@
FILE_MAN_SUFFIX = @FILE_MAN_SUFFIX@
GREP = @GREP@
@@ -131,12 +130,14 @@ INSTALL_DATA = @INSTALL_DATA@
INSTALL_PROGRAM = @INSTALL_PROGRAM@
INSTALL_SCRIPT = @INSTALL_SCRIPT@
INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
+LD = @LD@
LDFLAGS = @LDFLAGS@
LIBOBJS = @LIBOBJS@
LIBS = @LIBS@
LIBTOOL = @LIBTOOL@
LIB_MAN_DIR = @LIB_MAN_DIR@
LIB_MAN_SUFFIX = @LIB_MAN_SUFFIX@
+LIPO = @LIPO@
LN_S = @LN_S@
LOCALEDIR = @LOCALEDIR@
LTLIBOBJS = @LTLIBOBJS@
@@ -144,11 +145,16 @@ MAINT = @MAINT@
MAINTAINER_MODE_FALSE = @MAINTAINER_MODE_FALSE@
MAINTAINER_MODE_TRUE = @MAINTAINER_MODE_TRUE@
MAKEINFO = @MAKEINFO@
+MANIFEST_TOOL = @MANIFEST_TOOL@
MAN_SUBSTS = @MAN_SUBSTS@
MISC_MAN_DIR = @MISC_MAN_DIR@
MISC_MAN_SUFFIX = @MISC_MAN_SUFFIX@
+NM = @NM@
NMEDIT = @NMEDIT@
+OBJDUMP = @OBJDUMP@
OBJEXT = @OBJEXT@
+OTOOL = @OTOOL@
+OTOOL64 = @OTOOL64@
PACKAGE = @PACKAGE@
PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
PACKAGE_NAME = @PACKAGE_NAME@
@@ -161,6 +167,7 @@ RANLIB = @RANLIB@
SED = @SED@
SET_MAKE = @SET_MAKE@
SHELL = @SHELL@
+STRICT_CFLAGS = @STRICT_CFLAGS@
STRIP = @STRIP@
SXPM_CFLAGS = @SXPM_CFLAGS@
SXPM_LIBS = @SXPM_LIBS@
@@ -170,13 +177,11 @@ VERSION = @VERSION@
XORG_MAN_PAGE = @XORG_MAN_PAGE@
XPM_CFLAGS = @XPM_CFLAGS@
XPM_LIBS = @XPM_LIBS@
+ac_ct_AR = @ac_ct_AR@
ac_ct_CC = @ac_ct_CC@
-ac_ct_CXX = @ac_ct_CXX@
-ac_ct_F77 = @ac_ct_F77@
+ac_ct_DUMPBIN = @ac_ct_DUMPBIN@
am__fastdepCC_FALSE = @am__fastdepCC_FALSE@
am__fastdepCC_TRUE = @am__fastdepCC_TRUE@
-am__fastdepCXX_FALSE = @am__fastdepCXX_FALSE@
-am__fastdepCXX_TRUE = @am__fastdepCXX_TRUE@
am__include = @am__include@
am__leading_dot = @am__leading_dot@
am__quote = @am__quote@
diff --git a/lib/libXpm/src/RdFToBuf.c b/lib/libXpm/src/RdFToBuf.c
index b719960af..8501d239a 100644
--- a/lib/libXpm/src/RdFToBuf.c
+++ b/lib/libXpm/src/RdFToBuf.c
@@ -98,12 +98,12 @@ XpmReadFileToBuffer(
fclose(fp);
#ifdef VMS
/* VMS often stores text files in a variable-length record format,
- where there are two bytes of size followed by the record. fread
- converts this so it looks like a record followed by a newline.
- Unfortunately, the size reported by fstat() (and fseek/ftell)
- counts the two bytes for the record terminator, while fread()
- counts only one. So, fread() sees fewer bytes in the file (size
- minus # of records) and thus when asked to read the amount
+ where there are two bytes of size followed by the record. fread
+ converts this so it looks like a record followed by a newline.
+ Unfortunately, the size reported by fstat() (and fseek/ftell)
+ counts the two bytes for the record terminator, while fread()
+ counts only one. So, fread() sees fewer bytes in the file (size
+ minus # of records) and thus when asked to read the amount
returned by stat(), it fails.
The best solution, suggested by DEC, seems to consider the length
returned from fstat() as an upper bound and call fread() with
diff --git a/lib/libXpm/src/WrFFrI.c b/lib/libXpm/src/WrFFrI.c
index f2726f995..b592fa154 100644
--- a/lib/libXpm/src/WrFFrI.c
+++ b/lib/libXpm/src/WrFFrI.c
@@ -51,7 +51,7 @@
#endif
/* MS Windows define a function called WriteFile @#%#&!!! */
-LFUNC(xpmWriteFile, int, (FILE *file, XpmImage *image, char *name,
+LFUNC(xpmWriteFile, int, (FILE *file, XpmImage *image, const char *name,
XpmInfo *info));
LFUNC(WriteColors, void, (FILE *file, XpmColor *colors, unsigned int ncolors));
@@ -104,7 +104,8 @@ XpmWriteFileFromXpmImage(
XpmInfo *info)
{
xpmData mdata;
- char *name, *dot, *s, new_name[BUFSIZ] = {0};
+ const char *name;
+ char *dot, *s, new_name[BUFSIZ] = {0};
int ErrorStatus;
/* open file to write */
@@ -143,7 +144,7 @@ XpmWriteFileFromXpmImage(
name = new_name;
}
/* change '-' to '_' */
- s = name;
+ s = new_name;
while ((dot = strchr(s, '-'))) {
*dot = '_';
s = dot;
@@ -165,7 +166,7 @@ static int
xpmWriteFile(
FILE *file,
XpmImage *image,
- char *name,
+ const char *name,
XpmInfo *info)
{
/* calculation variables */
@@ -256,8 +257,8 @@ WritePixels(
unsigned int x, y, h;
h = height - 1;
- if (cpp != 0 && width >= (UINT_MAX - 3)/cpp)
- return XpmNoMemory;
+ if (cpp != 0 && width >= (UINT_MAX - 3)/cpp)
+ return XpmNoMemory;
p = buf = (char *) XpmMalloc(width * cpp + 3);
if (!buf)
return (XpmNoMemory);
diff --git a/lib/libXpm/src/XpmI.h b/lib/libXpm/src/XpmI.h
index 9d4b1aeee..122aea508 100644
--- a/lib/libXpm/src/XpmI.h
+++ b/lib/libXpm/src/XpmI.h
@@ -98,7 +98,7 @@ extern FILE *popen();
#ifndef SIZE_MAX
# ifdef ULONG_MAX
# define SIZE_MAX ULONG_MAX
-# else
+# else
# define SIZE_MAX UINT_MAX
# endif
#endif
@@ -114,7 +114,8 @@ typedef struct {
unsigned int line;
int CommentLength;
char Comment[XPMMAXCMTLEN];
- char *Bcmt, *Ecmt, Bos, Eos;
+ const char *Bcmt, *Ecmt;
+ char Bos, Eos;
int format; /* 1 if XPM1, 0 otherwise */
#ifdef CXPMPROG
int lineNum;
@@ -132,15 +133,15 @@ typedef struct {
#define SPC ' '
typedef struct {
- char *type; /* key word */
- char *Bcmt; /* string beginning comments */
- char *Ecmt; /* string ending comments */
+ const char *type; /* key word */
+ const char *Bcmt; /* string beginning comments */
+ const char *Ecmt; /* string ending comments */
char Bos; /* character beginning strings */
char Eos; /* character ending strings */
- char *Strs; /* strings separator */
- char *Dec; /* data declaration string */
- char *Boa; /* string beginning assignment */
- char *Eoa; /* string ending assignment */
+ const char *Strs; /* strings separator */
+ const char *Dec; /* data declaration string */
+ const char *Boa; /* string beginning assignment */
+ const char *Eoa; /* string ending assignment */
} xpmDataType;
extern xpmDataType xpmDataTypes[];
@@ -157,7 +158,7 @@ typedef struct {
/* Maximum number of rgb mnemonics allowed in rgb text file. */
#define MAX_RGBNAMES 1024
-extern char *xpmColorKeys[];
+extern const char *xpmColorKeys[];
#define TRANSPARENT_COLOR "None" /* this must be a string! */
@@ -306,24 +307,20 @@ FUNC(xpm_znormalizeimagebits, void, (register unsigned char *bp,
#define ZINDEX1(x, y, img) ((y) * img->bytes_per_line) + ((x) >> 3)
#endif /* not AMIGA */
-#ifdef __STDC__
-#define Const const
-#else
-#define Const /**/
-#endif
-
#ifdef NEED_STRDUP
FUNC(xpmstrdup, char *, (char *s1));
#else
#undef xpmstrdup
#define xpmstrdup strdup
+#include <string.h>
#endif
-#ifdef NEED_STRCASECMP
+#ifdef NEED_STRCASECMP
FUNC(xpmstrcasecmp, int, (char *s1, char *s2));
#else
#undef xpmstrcasecmp
#define xpmstrcasecmp strcasecmp
+#include <strings.h>
#endif
FUNC(xpmatoui, unsigned int,
diff --git a/lib/libXpm/src/amigax.c b/lib/libXpm/src/amigax.c
index eb3bc3a4c..f163960ff 100644
--- a/lib/libXpm/src/amigax.c
+++ b/lib/libXpm/src/amigax.c
@@ -58,7 +58,7 @@ AllocRastPort (
unsigned int depth)
{
struct RastPort *rp;
-
+
rp = XpmMalloc (sizeof (*rp));
if (rp != NULL)
{
@@ -75,14 +75,14 @@ AllocRastPort (
else
{
unsigned int i;
-
+
rp->BitMap = XpmMalloc (sizeof (*rp->BitMap));
if (rp->BitMap == NULL)
{
FreeRastPort (rp, width, height);
return NULL;
}
-
+
InitBitMap (rp->BitMap, depth, width, height);
for (i = 0; i < depth; ++i)
rp->BitMap->Planes[i] = NULL;
@@ -97,7 +97,7 @@ AllocRastPort (
}
}
}
-
+
return rp;
}
@@ -118,7 +118,7 @@ FreeRastPort (
else
{
unsigned int i;
-
+
for (i = 0; i < rp->BitMap->Depth; ++i)
{
if (rp->BitMap->Planes[i] != NULL)
@@ -139,7 +139,7 @@ AllocXImage (
unsigned int depth)
{
XImage *img;
-
+
img = XpmMalloc (sizeof (*img));
if (img != NULL)
{
@@ -152,7 +152,7 @@ AllocXImage (
return NULL;
}
}
-
+
return img;
}
@@ -166,7 +166,7 @@ FreeXImage (
FreeRastPort (ximage->rp, ximage->width, ximage->height);
XpmFree (ximage);
}
-
+
return Success;
}
@@ -180,7 +180,7 @@ XPutPixel (
{
SetAPen (ximage->rp, pixel);
WritePixel (ximage->rp, x, y);
-
+
return Success;
}
@@ -195,7 +195,7 @@ AllocBestPen (
if (GfxBase->LibNode.lib_Version >= 39)
{
unsigned long r, g, b;
-
+
r = screen_in_out->red * 0x00010001;
g = screen_in_out->green * 0x00010001;
b = screen_in_out->blue * 0x00010001;
@@ -205,7 +205,7 @@ AllocBestPen (
TAG_DONE);
if (screen_in_out->pixel == -1)
return False;
-
+
QueryColor (colormap, screen_in_out);
}
else
@@ -213,7 +213,7 @@ AllocBestPen (
XColor nearest, trial;
long nearest_delta, trial_delta;
int num_cells, i;
-
+
num_cells = colormap->Count;
nearest.pixel = 0;
QueryColor (colormap, &nearest);
@@ -249,7 +249,7 @@ AllocBestPen (
screen_in_out->green = nearest.green;
screen_in_out->blue = nearest.blue;
}
-
+
return True;
}
@@ -263,11 +263,11 @@ FreePens (
if (GfxBase->LibNode.lib_Version >= 39)
{
int i;
-
+
for (i = 0; i < npixels; i++)
ReleasePen (colormap, pixels[i]);
}
-
+
return Success;
}
@@ -278,20 +278,20 @@ ParseColor (
XColor *exact_def_return)
{
int spec_length;
-
+
if (spec == 0)
return False;
-
+
spec_length = strlen(spec);
if (spec[0] == '#')
{
int hexlen;
char hexstr[10];
-
+
hexlen = (spec_length - 1) / 3;
if (hexlen < 1 || hexlen > 4 || hexlen * 3 != spec_length - 1)
return False;
-
+
hexstr[hexlen] = '\0';
strncpy (hexstr, spec + 1, hexlen);
exact_def_return->red = strtoul (hexstr, NULL, 16) << (16 - 4*hexlen);
@@ -299,7 +299,7 @@ ParseColor (
exact_def_return->green = strtoul (hexstr, NULL, 16) << (16 - 4*hexlen);
strncpy (hexstr, spec + 1 + 2 * hexlen, hexlen);
exact_def_return->blue = strtoul (hexstr, NULL, 16) << (16 - 4*hexlen);
-
+
return True;
}
else
@@ -308,25 +308,25 @@ ParseColor (
int items, red, green, blue;
char line[512], name[512];
Bool success = False;
-
+
rgbf = fopen ("LIBS:rgb.txt", "r");
if (rgbf == NULL)
return False;
-
+
while (fgets(line, sizeof (line), rgbf) && !success)
{
items = sscanf (line, "%d %d %d %[^\n]\n",
&red, &green, &blue, name);
if (items != 4)
continue;
-
+
if (red < 0 || red > 0xFF
|| green < 0 || green > 0xFF
|| blue < 0 || blue > 0xFF)
{
continue;
}
-
+
if (0 == xpmstrcasecmp (spec, name))
{
exact_def_return->red = red * 0x0101;
@@ -336,7 +336,7 @@ ParseColor (
}
}
fclose (rgbf);
-
+
return success;
}
}
@@ -350,7 +350,7 @@ QueryColor (
if (GfxBase->LibNode.lib_Version >= 39)
{
unsigned long rgb[3];
-
+
GetRGB32 (colormap, def_in_out->pixel, 1, rgb);
def_in_out->red = rgb[0] >> 16;
def_in_out->green = rgb[1] >> 16;
@@ -359,13 +359,13 @@ QueryColor (
else
{
unsigned short rgb;
-
+
rgb = GetRGB4 (colormap, def_in_out->pixel);
def_in_out->red = ((rgb >> 8) & 0xF) * 0x1111;
def_in_out->green = ((rgb >> 4) & 0xF) * 0x1111;
def_in_out->blue = (rgb & 0xF) * 0x1111;
}
-
+
return Success;
}
@@ -377,9 +377,9 @@ QueryColors (
int ncolors)
{
int i;
-
+
for (i = 0; i < ncolors; i++)
QueryColor (colormap, &defs_in_out[i]);
-
+
return Success;
}
diff --git a/lib/libXpm/src/create.c b/lib/libXpm/src/create.c
index 7c75a4211..98678d8f3 100644
--- a/lib/libXpm/src/create.c
+++ b/lib/libXpm/src/create.c
@@ -219,9 +219,9 @@ typedef struct {
} CloseColor;
static int
-closeness_cmp(Const void *a, Const void *b)
+closeness_cmp(const void *a, const void *b)
{
- CloseColor *x = (CloseColor *) a, *y = (CloseColor *) b;
+ const CloseColor *x = (const CloseColor *) a, *y = (const CloseColor *) b;
/* cast to int as qsort requires */
return (int) (x->closeness - y->closeness);
@@ -309,17 +309,17 @@ SetCloseColor(
* occurred, so we try the next closest color, and so on, until no more
* colors are within closeness of the target. If we knew that the
* colormap had changed, we could skip this sequence.
- *
+ *
* If _none_ of the colors within closeness of the target can be allocated,
* then we can finally be pretty sure that the colormap has actually
* changed. In this case we try to allocate the original color (again),
* then try the closecolor stuff (again)...
- *
+ *
* In theory it would be possible for an infinite loop to occur if another
* process kept changing the colormap every time we sorted it, so we set
* a maximum on the number of iterations. After this many tries, we use
* XGrabServer() to ensure that the colormap remains unchanged.
- *
+ *
* This approach gives particularly bad worst case performance - as many as
* <MaximumIterations> colormap reads and sorts may be needed, and as
* many as <MaximumIterations> * <ColormapSize> attempted allocations
@@ -816,7 +816,7 @@ XpmCreateImageFromXpmImage(
ErrorStatus = XpmSuccess;
- if (image->ncolors >= UINT_MAX / sizeof(Pixel))
+ if (image->ncolors >= UINT_MAX / sizeof(Pixel))
return (XpmNoMemory);
/* malloc pixels index tables */
@@ -1028,7 +1028,7 @@ LFUNC(_putbits, void, (register char *src, int dstoffset,
LFUNC(_XReverse_Bytes, int, (register unsigned char *bpt, register unsigned int nb));
-static unsigned char Const _reverse_byte[0x100] = {
+static unsigned char const _reverse_byte[0x100] = {
0x00, 0x80, 0x40, 0xc0, 0x20, 0xa0, 0x60, 0xe0,
0x10, 0x90, 0x50, 0xd0, 0x30, 0xb0, 0x70, 0xf0,
0x08, 0x88, 0x48, 0xc8, 0x28, 0xa8, 0x68, 0xe8,
@@ -1146,9 +1146,9 @@ xpm_znormalizeimagebits(
}
}
-static unsigned char Const _lomask[0x09] = {
+static unsigned char const _lomask[0x09] = {
0x00, 0x01, 0x03, 0x07, 0x0f, 0x1f, 0x3f, 0x7f, 0xff};
-static unsigned char Const _himask[0x09] = {
+static unsigned char const _himask[0x09] = {
0xff, 0xfe, 0xfc, 0xf8, 0xf0, 0xe0, 0xc0, 0x80, 0x00};
static void
@@ -1692,7 +1692,7 @@ APutImagePixels (
unsigned char *array;
XImage *tmp_img;
BOOL success = FALSE;
-
+
array = XpmMalloc ((((width+15)>>4)<<4)*sizeof (*array));
if (array != NULL)
{
@@ -1711,7 +1711,7 @@ APutImagePixels (
}
XpmFree (array);
}
-
+
if (!success)
{
for (y = 0; y < height; ++y)
@@ -1890,7 +1890,7 @@ PutPixel16MSB(
unsigned long pixel)
{
unsigned char *addr;
-
+
if(x < 0 || y < 0)
return 0;
@@ -1908,7 +1908,7 @@ PutPixel16LSB(
unsigned long pixel)
{
unsigned char *addr;
-
+
if(x < 0 || y < 0)
return 0;
@@ -2092,7 +2092,7 @@ xpmParseDataAndCreate(
xpmGetCmt(data, &colors_cmt);
/* malloc pixels index tables */
- if (ncolors >= UINT_MAX / sizeof(Pixel))
+ if (ncolors >= UINT_MAX / sizeof(Pixel))
RETURN(XpmNoMemory);
image_pixels = (Pixel *) XpmMalloc(sizeof(Pixel) * ncolors);
diff --git a/lib/libXpm/src/data.c b/lib/libXpm/src/data.c
index 347aa46a2..898889c37 100644
--- a/lib/libXpm/src/data.c
+++ b/lib/libXpm/src/data.c
@@ -61,7 +61,8 @@ ParseComment(xpmData *data)
register char c;
register unsigned int n = 0;
unsigned int notend;
- char *s, *s2;
+ char *s;
+ const char *s2;
s = data->Comment;
*s = data->Bcmt[0];
@@ -119,7 +120,8 @@ ParseComment(xpmData *data)
register int c;
register unsigned int n = 0, a;
unsigned int notend;
- char *s, *s2;
+ char *s;
+ const char *s2;
s = data->Comment;
*s = data->Bcmt[0];
diff --git a/lib/libXpm/src/hashtab.c b/lib/libXpm/src/hashtab.c
index 49e6e4831..1bd4109a4 100644
--- a/lib/libXpm/src/hashtab.c
+++ b/lib/libXpm/src/hashtab.c
@@ -146,7 +146,7 @@ HashTableGrows(xpmHashTable *table)
HASH_TABLE_GROWS
table->size = size;
table->limit = size / 3;
- if (size >= UINT_MAX / sizeof(*atomTable))
+ if (size >= UINT_MAX / sizeof(*atomTable))
return (XpmNoMemory);
atomTable = (xpmHashAtom *) XpmMalloc(size * sizeof(*atomTable));
if (!atomTable)
diff --git a/lib/libXpm/src/parse.c b/lib/libXpm/src/parse.c
index 5c7915f78..ff23a4738 100644
--- a/lib/libXpm/src/parse.c
+++ b/lib/libXpm/src/parse.c
@@ -70,7 +70,7 @@ LFUNC(ParsePixels, int, (xpmData *data, unsigned int width,
unsigned int cpp, XpmColor *colorTable,
xpmHashTable *hashtable, unsigned int **pixels));
-char *xpmColorKeys[] = {
+const char *xpmColorKeys[] = {
"s", /* key #1: symbol */
"m", /* key #2: mono visual */
"g4", /* key #3: 4 grays visual */
@@ -205,7 +205,8 @@ xpmParseColors(
unsigned int lastwaskey; /* key read */
char buf[BUFSIZ+1];
char curbuf[BUFSIZ]; /* current buffer */
- char **sptr, *s;
+ const char **sptr;
+ char *s;
XpmColor *color;
XpmColor *colorTable;
char **defaults;
@@ -380,7 +381,7 @@ ParsePixels(
unsigned int a, x, y;
if ((height > 0 && width >= UINT_MAX / height) ||
- width * height >= UINT_MAX / sizeof(unsigned int))
+ width * height >= UINT_MAX / sizeof(unsigned int))
return XpmNoMemory;
#ifndef FOR_MSW
iptr2 = (unsigned int *) XpmMalloc(sizeof(unsigned int) * width * height);
diff --git a/lib/libXpm/src/rgb.c b/lib/libXpm/src/rgb.c
index 848ae1f11..729898d36 100644
--- a/lib/libXpm/src/rgb.c
+++ b/lib/libXpm/src/rgb.c
@@ -71,7 +71,7 @@ xpmReadRgbNames(
/* Loop reading each line in the file. */
n = 0;
- rgb = rgbn;
+ rgb = rgbn;
/* Quit if rgb text file has too many entries. */
while (fgets(line, sizeof(line), rgbf) && n < MAX_RGBNAMES) {
diff --git a/lib/libXpm/src/scan.c b/lib/libXpm/src/scan.c
index d2780a1ee..54c8da502 100644
--- a/lib/libXpm/src/scan.c
+++ b/lib/libXpm/src/scan.c
@@ -53,7 +53,7 @@
* minus \ and " for string compat
* and ? to avoid ANSI trigraphs. */
-static char *printable =
+static const char *printable =
" .XoO+@#$%&*=-;:>,<1234567890qwertyuipasdfghjklzxcvbnmMNBVCZ\
ASDFGHJKLPIUYTREWQ!~^/()_`'][{}|";
@@ -111,8 +111,8 @@ LFUNC(MSWGetImagePixels, int, (Display *d, XImage *image, unsigned int width,
LFUNC(ScanTransparentColor, int, (XpmColor *color, unsigned int cpp,
XpmAttributes *attributes));
-LFUNC(ScanOtherColors, int, (Display *display, XpmColor *colors,
- unsigned int ncolors,
+LFUNC(ScanOtherColors, int, (Display *display, XpmColor *colors,
+ unsigned int ncolors,
Pixel *pixels, unsigned int mask,
unsigned int cpp, XpmAttributes *attributes));
@@ -244,7 +244,7 @@ XpmCreateXpmImageFromImage(
if (!pmap.pixelindex)
RETURN(XpmNoMemory);
- if (pmap.size >= UINT_MAX / sizeof(Pixel))
+ if (pmap.size >= UINT_MAX / sizeof(Pixel))
RETURN(XpmNoMemory);
pmap.pixels = (Pixel *) XpmMalloc(sizeof(Pixel) * pmap.size);
@@ -273,10 +273,10 @@ XpmCreateXpmImageFromImage(
/*
* scan the image data
- *
+ *
* In case depth is 1 or bits_per_pixel is 4, 6, 8, 24 or 32 use optimized
* functions, otherwise use slower but sure general one.
- *
+ *
*/
if (image) {
@@ -433,8 +433,8 @@ ScanOtherColors(
#ifndef FOR_MSW
xpmRgbName rgbn[MAX_RGBNAMES];
#else
- xpmRgbName *rgbn = NULL;
-#endif
+ xpmRgbName *rgbn = NULL;
+#endif
int rgbn_max = 0;
unsigned int i, j, c, i2;
XpmColor *color;
@@ -559,10 +559,10 @@ ScanOtherColors(
#ifndef FOR_MSW
sprintf(buf, "#%04X%04X%04X",
xcolor->red, xcolor->green, xcolor->blue);
-#else
+#else
sprintf(buf, "#%02x%02x%02x",
xcolor->red, xcolor->green, xcolor->blue);
-#endif
+#endif
color->c_color = (char *) xpmstrdup(buf);
}
if (!color->c_color) {
@@ -589,7 +589,7 @@ ScanOtherColors(
* level.
*/
-static unsigned long Const low_bits_table[] = {
+static unsigned long const low_bits_table[] = {
0x00000000, 0x00000001, 0x00000003, 0x00000007,
0x0000000f, 0x0000001f, 0x0000003f, 0x0000007f,
0x000000ff, 0x000001ff, 0x000003ff, 0x000007ff,
@@ -924,15 +924,15 @@ AGetImagePixels (
unsigned int x, y;
unsigned char *pixels;
XImage *tmp_img;
-
+
pixels = XpmMalloc ((((width+15)>>4)<<4)*sizeof (*pixels));
if (pixels == NULL)
return XpmNoMemory;
-
+
tmp_img = AllocXImage ((((width+15)>>4)<<4), 1, image->rp->BitMap->Depth);
if (tmp_img == NULL)
CLEAN_UP (XpmNoMemory);
-
+
iptr = pmap->pixelindex;
for (y = 0; y < height; ++y)
{
@@ -943,7 +943,7 @@ AGetImagePixels (
CLEAN_UP (XpmNoMemory);
}
}
-
+
CLEAN_UP (XpmSuccess);
}
diff --git a/lib/libXpm/src/simx.c b/lib/libXpm/src/simx.c
index 97b3b5f03..c76934b08 100644
--- a/lib/libXpm/src/simx.c
+++ b/lib/libXpm/src/simx.c
@@ -122,7 +122,7 @@ XDefaultScreen(Display *d)
/* I get only 1 plane but 8 bits per pixel,
so I think BITSPIXEL should be depth */
-int
+int
XDefaultDepth(Display *display, Screen *screen)
{
int d, b;
@@ -140,7 +140,7 @@ XDefaultColormap(Display *display, Screen *screen)
/* convert hex color names,
wrong digits (not a-f,A-F,0-9) are treated as zero */
-static int
+static int
hexCharToInt(c)
{
int r;
@@ -157,7 +157,7 @@ hexCharToInt(c)
return (r);
}
-static int
+static int
rgbFromHex(char *hex, int *r, int *g, int *b)
{
int len;
@@ -187,7 +187,7 @@ rgbFromHex(char *hex, int *r, int *g, int *b)
}
/* Color related functions */
-int
+int
XParseColor(Display *d, Colormap *cmap, char *name, XColor *color)
{
int r, g, b; /* only 8 bit values used */
@@ -215,14 +215,14 @@ XParseColor(Display *d, Colormap *cmap, char *name, XColor *color)
}
-int
+int
XAllocColor(Display *d, Colormap cmap, XColor *color)
{
/* colormap not used yet so color->pixel is the real COLORREF (RBG) and not an
index in some colormap as in X */
return (1);
}
-void
+void
XQueryColors(Display *display, Colormap *colormap,
XColor *xcolors, int ncolors)
{
@@ -238,7 +238,7 @@ XQueryColors(Display *display, Colormap *colormap,
}
return;
}
-int
+int
XFreeColors(Display *d, Colormap cmap,
unsigned long pixels[], int npixels, unsigned long planes)
{
@@ -274,14 +274,14 @@ XCreateImage(Display *d, Visual *v,
}
-void
+void
XImageFree(XImage *img)
{
if (img) {
XpmFree(img);
}
}
-void
+void
XDestroyImage(XImage *img)
{
if (img) {