source@mandoc.bsd.lv
 help / color / mirror / Atom feed
From: schwarze@mandoc.bsd.lv
To: source@mandoc.bsd.lv
Subject: docbook2mdoc: fix systematically wrong (int) casts in character
Date: Fri, 8 Mar 2019 10:10:25 -0500 (EST)	[thread overview]
Message-ID: <e3f18941e5a54239@fantadrom.bsd.lv> (raw)

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

                 reply	other threads:[~2019-03-08 15:10 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=e3f18941e5a54239@fantadrom.bsd.lv \
    --to=schwarze@mandoc.bsd.lv \
    --cc=source@mandoc.bsd.lv \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).