* docbook2mdoc: fix systematically wrong (int) casts in character
@ 2019-03-08 15:10 schwarze
0 siblings, 0 replies; only message in thread
From: schwarze @ 2019-03-08 15:10 UTC (permalink / raw)
To: source
Log Message:
-----------
fix systematically wrong (int) casts in character classification functions
Modified Files:
--------------
docbook2mdoc:
docbook2mdoc.c
Revision Data
-------------
Index: docbook2mdoc.c
===================================================================
RCS file: /home/cvs/mdocml/docbook2mdoc/docbook2mdoc.c,v
retrieving revision 1.45
retrieving revision 1.46
diff -Ldocbook2mdoc.c -Ldocbook2mdoc.c -u -p -r1.45 -r1.46
--- docbook2mdoc.c
+++ docbook2mdoc.c
@@ -225,7 +225,7 @@ xml_char(void *arg, const XML_Char *p, i
*/
if (NODE_TEXT != ps->node) {
for (i = 0; i < sz; i++)
- if ( ! isspace((int)p[i]))
+ if ( ! isspace((unsigned char)p[i]))
break;
if (i == sz)
return;
@@ -265,7 +265,7 @@ pnode_trim(struct pnode *pn)
assert(NODE_TEXT == pn->node);
for ( ; pn->bsz > 0; pn->bsz--)
- if ( ! isspace((int)pn->b[pn->bsz - 1]))
+ if ( ! isspace((unsigned char)pn->b[pn->bsz - 1]))
break;
}
@@ -580,27 +580,27 @@ pnode_printmacrolinetext(struct parse *p
/* Convert all space to spaces. */
for (cp = p->b; '\0' != *cp; cp++)
- if (isspace((int)*cp))
+ if (isspace((unsigned char)*cp))
*cp = ' ';
- for (cp = p->b; isspace((int)*cp); cp++)
+ for (cp = p->b; isspace((unsigned char)*cp); cp++)
/* Spin past whitespace (XXX: necessary?) */ ;
for ( ; '\0' != *cp; cp++) {
/* Escape us if we look like a macro. */
if ((cp == p->b || ' ' == *(cp - 1)) &&
- isupper((int)*cp) &&
+ isupper((unsigned char)*cp) &&
'\0' != *(cp + 1) &&
- islower((int)*(cp + 1)) &&
+ islower((unsigned char)*(cp + 1)) &&
('\0' == *(cp + 2) ||
' ' == *(cp + 2) ||
- (islower((int)*(cp + 2)) &&
+ (islower((unsigned char)*(cp + 2)) &&
('\0' == *(cp + 3) ||
' ' == *(cp + 3)))))
fputs("\\&", stdout);
if (MACROLINE_UPPER & fl)
- putchar(toupper((int)*cp));
+ putchar(toupper((unsigned char)*cp));
else
- putchar((int)*cp);
+ putchar(*cp);
/* If we're a character escape, escape us. */
if ('\\' == *cp)
putchar('e');
@@ -672,7 +672,7 @@ pnode_printmclosepunct(struct parse *p,
/* Only do this for the comma/period. */
if (pn->bsz > 0 &&
(',' == pn->b[0] || '.' == pn->b[0]) &&
- (1 == pn->bsz || isspace((int)pn->b[1]))) {
+ (1 == pn->bsz || isspace((unsigned char)pn->b[1]))) {
putchar(' ');
putchar(pn->b[0]);
pn->b++;
@@ -1455,8 +1455,8 @@ pnode_print(struct parse *p, struct pnod
for (last = '\n'; '\0' != *cp; ) {
if ('\n' == last) {
/* Consume all whitespace. */
- if (isspace((int)*cp)) {
- while (isspace((int)*cp))
+ if (isspace((unsigned char)*cp)) {
+ while (isspace((unsigned char)*cp))
cp++;
continue;
} else if ('\'' == *cp || '.' == *cp)
--
To unsubscribe send an email to source+unsubscribe@mandoc.bsd.lv
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2019-03-08 15:10 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-03-08 15:10 docbook2mdoc: fix systematically wrong (int) casts in character schwarze
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).