Dear Maintainer,
Add header files <stdio.h> and <unistd.d>.
Cast an integer to "unsigned char" for the functions "isspace()" and
"isupper()".
Fix type from "int" to "size_t" for the last argument in "strncmp()".
Add the file name in a message.
Signed-off-by: Bjarni Ingi Gislason <bjarniig@rhi.hi.is>
---
sequence.c | 29 ++++++++++++++++-------------
1 file changed, 16 insertions(+), 13 deletions(-)
diff --git a/sequence.c b/sequence.c
index 2613794..6db6965 100644
--- a/sequence.c
+++ b/sequence.c
@@ -5,8 +5,10 @@
* Read presentation sequence file
*/
+#include <stdio.h>
#include <stdlib.h>
#include <string.h>
+#include <unistd.h>
#include <ctype.h>
#include "config.h"
#include "global.h"
@@ -263,7 +265,7 @@ visit_presentation_file(char *directory, char *seqfile, FILE * hook)
if ((c = getc(sf)) == EOF)
break;
- if (!isascii(c) || isspace(c))
+ if (!isascii(c) || isspace((unsigned char) c))
continue;
switch (c) {
@@ -282,7 +284,8 @@ visit_presentation_file(char *directory, char *seqfile, FILE * hook)
if (c == ':') {
if ((c = getc(sf)) == EOF)
continue;
- if (!isascii(c) || isspace(c) || !isupper(c))
+ if (!isascii(c) || isspace((unsigned char) c)
+ || !isupper((unsigned char) c))
continue;
switch (c) {
case 'O':
@@ -339,31 +342,31 @@ visit_presentation_file(char *directory, char *seqfile, FILE * hook)
if (c == ',')
merge_groups = 1;
c = getc(sf);
- } while (c != EOF && isascii(c) && !isspace(c));
+ } while (c != EOF && isascii(c) && !isspace((unsigned char) c));
*gp = NUL;
- while (c != EOF && (!isascii(c) || isspace(c)))
+ while (c != EOF && (!isascii(c) || isspace((unsigned char) c)))
c = getc(sf);
if (c == '+' || c == '~' || c == '/') {
gp = savefile;
if (c == '+') {
c = getc(sf);
- if (c == EOF || (isascii(c) && isspace(c)))
+ if (c == EOF || (isascii(c) && isspace((unsigned char) c)))
goto use_same_savefile;
*gp++ = '+';
}
do {
*gp++ = c;
c = getc(sf);
- } while (c != EOF && isascii(c) && !isspace(c));
+ } while (c != EOF && isascii(c) && !isspace((unsigned char) c));
*gp = NUL;
dflt_save = savefile[0] ? copy_str(savefile) : NULL;
} else
dflt_save = NULL;
use_same_savefile:
- while (c != EOF && (!isascii(c) || isspace(c)))
+ while (c != EOF && (!isascii(c) || isspace((unsigned char) c)))
c = getc(sf);
if (c == '(') {
enter_macro = parse_enter_macro(sf, getc(sf));
@@ -430,7 +433,7 @@ parse_save_files(register FILE * sf)
for (;;) {
if ((c = getc(sf)) == EOF)
break;
- if (!isascii(c) || isspace(c))
+ if (!isascii(c) || isspace((unsigned char) c))
continue;
if (c == '#') {
do
@@ -442,20 +445,20 @@ parse_save_files(register FILE * sf)
do {
*gp++ = c;
c = getc(sf);
- } while (c != EOF && isascii(c) && !isspace(c));
+ } while (c != EOF && isascii(c) && !isspace((unsigned char) c));
*gp = NUL;
if (strcmp(group, "end") == 0)
break;
- while (c != EOF && (!isascii(c) || isspace(c)))
+ while (c != EOF && (!isascii(c) || isspace((unsigned char) c)))
c = getc(sf);
gp = namebuf;
do {
*gp++ = c;
c = getc(sf);
- } while (c != EOF && isascii(c) && !isspace(c));
+ } while (c != EOF && isascii(c) && !isspace((unsigned char) c));
*gp = NUL;
if (namebuf[0] == NUL)
break;
@@ -650,7 +653,7 @@ start_group_search(char *group)
gs_group = group;
}
-#define STREQN(a, b, n) ((a)[0] == (b)[0] && strncmp(a, b, (int)(n)) == 0)
+#define STREQN(a, b, n) ((a)[0] == (b)[0] && strncmp(a, b, (size_t)(n)) == 0)
group_header *
get_group_search(void)
@@ -735,7 +738,7 @@ get_group_search(void)
break;
case GS_INFIX:
- nn_exitmsg(1, ".name. notation not supported (yet)");
+ nn_exitmsg(1, "%s: .name. notation not supported (yet)", __FILE__);
break;
case GS_ALL: