XPM warning removal

This commit is contained in:
Jay McCarthy 2010-05-18 10:14:58 -05:00
parent abf1be31c0
commit 7ed6c41aab
7 changed files with 39 additions and 24 deletions

View File

@ -232,7 +232,7 @@ WriteColors(dataptr, data_size, used_size, colors, ncolors, cpp)
s += cpp;
for (key = 1; key <= NKEYS; key++, defaults++) {
if (s2 = *defaults) {
if ((s2 = *defaults)) {
sprintf(s, "\t%s %s", xpmColorKeys[key - 1], s2);
s += strlen(s);
}

View File

@ -219,7 +219,7 @@ CreateColors(dataptr, data_size, colors, ncolors, cpp)
s = buf + cpp;
for (key = 1; key <= NKEYS; key++, defaults++) {
if (s2 = *defaults) {
if ((s2 = *defaults)) {
sprintf(s, "\t%s %s", xpmColorKeys[key - 1], s2);
s += strlen(s);
}

View File

@ -110,23 +110,23 @@ XpmWriteFileFromXpmImage(filename, image, info)
name++;
#endif
/* let's try to make a valid C syntax name */
if (dot = index(name, '.')) {
if ((dot = index(name, '.'))) {
strcpy(new_name, name);
/* change '.' to '_' */
name = s = new_name;
while (dot = index(s, '.')) {
while ((dot = index(s, '.'))) {
*dot = '_';
s = dot;
}
}
if (dot = index(name, '-')) {
if ((dot = index(name, '-'))) {
if (name != new_name) {
strcpy(new_name, name);
name = new_name;
}
/* change '-' to '_' */
s = name;
while (dot = index(s, '-')) {
while ((dot = index(s, '-'))) {
*dot = '_';
s = dot;
}
@ -217,7 +217,7 @@ WriteColors(file, colors, ncolors)
fprintf(file, "\"%s", *defaults++);
for (key = 1; key <= NKEYS; key++, defaults++) {
if (s = *defaults)
if ((s = *defaults))
fprintf(file, "\t%s %s", xpmColorKeys[key - 1], s);
}
fprintf(file, "\",\n");

View File

@ -32,9 +32,6 @@
* Developed by Arnaud Le Hors *
\*****************************************************************************/
/* Official version number */
static char *RCS_Version = "$XpmVersion: 3.4g $";
/* Internal version number */
#include "xpmP.h"
@ -45,6 +42,8 @@ static char *RCS_Version = "$XpmVersion: 3.4g $";
#include <strings.h>
#endif
/* Official version number */
MAYBE_UNUSED static char *RCS_Version = "$XpmVersion: 3.4g $";
LFUNC(ParseComment, int, (xpmData * mdata));
@ -386,13 +385,13 @@ xpmGetCmt(mdata, cmt)
xpmDataType xpmDataTypes[] =
{
"", "!", "\n", '\0', '\n', "", "", "", "", /* Natural type */
"C", "/*", "*/", '"', '"', ",\n", "static char *", "[] = {\n", "};\n",
"Lisp", ";", "\n", '"', '"', "\n", "(setq ", " '(\n", "))\n",
{"", "!", "\n", '\0', '\n', "", "", "", ""}, /* Natural type */
{"C", "/*", "*/", '"', '"', ",\n", "static char *", "[] = {\n", "};\n"},
{"Lisp", ";", "\n", '"', '"', "\n", "(setq ", " '(\n", "))\n"},
#ifdef VMS
NULL
#else
NULL, NULL, NULL, 0, 0, NULL, NULL, NULL, NULL
{NULL, NULL, NULL, 0, 0, NULL, NULL, NULL, NULL}
#endif
};

View File

@ -39,6 +39,7 @@
*/
#include "xpmP.h"
#include <stdint.h>
#include <ctype.h>
#if defined(SYSV) || defined(SVR4) || defined(VMS) || defined(__GNUC__)
#include <string.h>
@ -179,7 +180,7 @@ xpmParseData(data, image, info)
/*
* parse extensions
*/
if (info && (info->valuemask & XpmReturnExtensions))
if (info && (info->valuemask & XpmReturnExtensions)) {
if (extensions) {
ErrorStatus = ParseExtensions(data, &info->extensions,
&info->nextensions);
@ -189,6 +190,7 @@ xpmParseData(data, image, info)
info->extensions = NULL;
info->nextensions = 0;
}
}
/*
* store found informations in the XpmImage structure
@ -333,7 +335,8 @@ ParseColors(data, ncolors, cpp, colorTablePtr, hashtable)
XpmColor **colorTablePtr;
xpmHashTable *hashtable;
{
unsigned int key, l, a, b;
uintptr_t a;
unsigned int key, l, b;
unsigned int curkey; /* current color key */
unsigned int lastwaskey; /* key read */
char buf[BUFSIZ];
@ -383,7 +386,7 @@ ParseColors(data, ncolors, cpp, colorTablePtr, hashtable)
curkey = 0;
lastwaskey = 0;
*curbuf = '\0'; /* init curbuf */
while (l = xpmNextWord(data, buf, BUFSIZ)) {
while ((l = xpmNextWord(data, buf, BUFSIZ))) {
if (!lastwaskey) {
for (key = 0, sptr = xpmColorKeys; key < NKEYS; key++,
sptr++)
@ -463,7 +466,7 @@ ParseColors(data, ncolors, cpp, colorTablePtr, hashtable)
*/
xpmNextString(data); /* get to the next string */
*curbuf = '\0'; /* init curbuf */
while (l = xpmNextWord(data, buf, BUFSIZ)) {
while ((l = xpmNextWord(data, buf, BUFSIZ))) {
if (*curbuf != '\0')
strcat(curbuf, " ");/* append space */
buf[l] = '\0';

View File

@ -38,6 +38,11 @@
*/
#include "xpmP.h"
#if defined(SYSV) || defined(SVR4) || defined(VMS) || defined(__GNUC__)
#include <string.h>
#else
#include <strings.h>
#endif
#define MAXPRINTABLE 92 /* number of printable ascii chars
* minus \ and " for string compat
@ -352,7 +357,7 @@ ScanTransparentColor(color, cpp, attributes)
((XpmColor **) attributes->colorTable)[attributes->mask_pixel];
/* end 3.2 bc */
for (key = 1; key <= NKEYS; key++) {
if (s = mask_defaults[key]) {
if ((s = mask_defaults[key])) {
defaults[key] = (char *) strdup(s);
if (!defaults[key])
return (XpmNoMemory);
@ -390,10 +395,11 @@ ScanOtherColors(display, colors, ncolors, pixels, mask, cpp, attributes)
XpmColor *color;
XColor *xcolors = NULL, *xcolor;
char *colorname, *s;
XpmColor *colorTable, **oldColorTable = NULL;
XpmColor *colorTable = NULL;
XpmColor **oldColorTable = NULL;
unsigned int ancolors = 0;
Pixel *apixels;
unsigned int mask_pixel;
Pixel *apixels = NULL;
unsigned int mask_pixel = 0;
Bool found;
/* retrieve information from the XpmAttributes */
@ -495,7 +501,7 @@ ScanOtherColors(display, colors, ncolors, pixels, mask, cpp, attributes)
found = True;
for (key = 1; key <= NKEYS; key++) {
if (s = adefaults[key])
if ((s = adefaults[key]))
defaults[key] = (char *) strdup(s);
}
}

View File

@ -46,6 +46,7 @@
* lets try to solve include files
*/
#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>
/* stdio.h doesn't declare popen on a Sequent DYNIX OS */
@ -53,6 +54,12 @@
extern FILE *popen();
#endif
#if defined(__GNUC__)
# define MAYBE_UNUSED __attribute__((unused))
#else
# define MAYBE_UNUSED
#endif
#if defined(__FreeBSD__) || defined(SYSV) || defined(SVR4) || defined(VMS)
#include <string.h>
@ -291,7 +298,7 @@ FUNC(xpmHashSlot, xpmHashAtom *, (xpmHashTable *table, char *s));
FUNC(xpmHashIntern, int, (xpmHashTable *table, char *tag, void *data));
#define HashAtomData(i) ((void *)i)
#define HashColorIndex(slot) ((unsigned int)((*slot)->data))
#define HashColorIndex(slot) ((uintptr_t)((*slot)->data))
#define USE_HASHTABLE (cpp > 2 && ncolors > 4)
#ifdef NEED_STRDUP