From 11b1eba90baecf41b9e54b32827be864f0823469 Mon Sep 17 00:00:00 2001 From: Alan Coopersmith Date: Sat, 5 Jul 2014 14:47:00 -0700 Subject: Fix integer sign/size conversion warnings from clang & cppcheck Signed-off-by: Alan Coopersmith --- chars.c | 14 +++++++------- header.c | 16 ++++++++-------- props.c | 8 ++++---- 3 files changed, 19 insertions(+), 19 deletions(-) diff --git a/chars.c b/chars.c index 4a6fdfe..3eef537 100644 --- a/chars.c +++ b/chars.c @@ -155,17 +155,17 @@ EmitCharacters(FILE *outFile, { FSXCharInfo *extents; FSXCharInfo *charInfo; - int encoding; + unsigned int encoding; FSOffset *offsets; unsigned char *glyph; unsigned char *glyphs; unsigned int nChars; - int firstCharLow; - int firstCharHigh; - int lastCharLow; - int lastCharHigh; - int chLow; - int chHigh; + unsigned int firstCharLow; + unsigned int firstCharHigh; + unsigned int lastCharLow; + unsigned int lastCharHigh; + unsigned int chLow; + unsigned int chHigh; FSBitmapFormat format; nChars = 0; diff --git a/header.c b/header.c index 31814e6..1892276 100644 --- a/header.c +++ b/header.c @@ -66,17 +66,17 @@ static const char *warning[] = static char * FindStringProperty(const char *propName, - int *propLength, + unsigned int *propLength, FSPropInfo *propInfo, FSPropOffset *propOffsets, unsigned char *propData) { FSPropOffset *propOffset; - int length; - int i; + unsigned int length; + unsigned int i; propOffset = &propOffsets[0]; - length = strlen(propName); + length = (unsigned int) strlen(propName); for (i = propInfo->num_offsets; i--; propOffset++) { if (propOffset->type == PropTypeString) { @@ -109,11 +109,11 @@ FindNumberProperty(const char *propName, unsigned char *propData) { FSPropOffset *propOffset; - int i; - int length; + unsigned int i; + unsigned int length; propOffset = &propOffsets[0]; - length = strlen(propName); + length = (unsigned int) strlen(propName); for (i = propInfo->num_offsets; i--; propOffset++) { if ((propOffset->type == PropTypeSigned) || (propOffset->type == PropTypeUnsigned)) { @@ -138,7 +138,7 @@ EmitHeader(FILE *outFile, FSPropOffset *propOffsets, unsigned char *propData) { - int len; + unsigned int len; int type; char *cp; const char **cpp; diff --git a/props.c b/props.c index 465bea8..333491f 100644 --- a/props.c +++ b/props.c @@ -48,7 +48,7 @@ in this Software without prior written authorization from The Open Group. #include "fstobdf.h" static char * -AddQuotes(unsigned char *string, int length) +AddQuotes(unsigned char *string, unsigned int length) { static unsigned char new[256] = "\""; unsigned char *cp; @@ -72,7 +72,7 @@ EmitProperties(FILE *outFile, FSPropOffset *propOffsets, unsigned char *propData) { - int nProperties; + unsigned int nProperties; FSPropOffset *property; Bool needDefaultChar; Bool needFontAscent; @@ -85,7 +85,7 @@ EmitProperties(FILE *outFile, nProperties = propInfo->num_offsets; for (property = &propOffsets[0]; nProperties--; property++) { char *name; - int length; + unsigned int length; name = (char *)propData + property->name.position; length = property->name.length; @@ -122,7 +122,7 @@ EmitProperties(FILE *outFile, fprintf(outFile, "%lu\n", value); break; case PropTypeSigned: - fprintf(outFile, "%ld\n", value); + fprintf(outFile, "%ld\n", (signed long) value); break; default: fprintf(stderr, "unknown property type\n"); -- cgit v1.2.3