CVS commit: src/usr.bin/gencat
Module Name:src Committed By: wiz Date: Sat Jul 28 08:03:41 UTC 2018 Modified Files: src/usr.bin/gencat: gencat.1 Log Message: Use An -nosplit. Use Mt. Fix some mandoc lint. To generate a diff of this commit: cvs rdiff -u -r1.13 -r1.14 src/usr.bin/gencat/gencat.1 Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/usr.bin/gencat/gencat.1 diff -u src/usr.bin/gencat/gencat.1:1.13 src/usr.bin/gencat/gencat.1:1.14 --- src/usr.bin/gencat/gencat.1:1.13 Thu Dec 29 16:41:38 2011 +++ src/usr.bin/gencat/gencat.1 Sat Jul 28 08:03:41 2018 @@ -1,4 +1,4 @@ -.\" $NetBSD: gencat.1,v 1.13 2011/12/29 16:41:38 christos Exp $ +.\" $NetBSD: gencat.1,v 1.14 2018/07/28 08:03:41 wiz Exp $ .\" .\" Copyright (c) 2007 The NetBSD Foundation, Inc. .\" All rights reserved. @@ -178,7 +178,6 @@ described above is ignored as a syntax e .Pp Text message strings may contain any characters and the following special characters and escape sequences. -.Pp .Bl -column -offset indent ".Sy carriage return" ".Sy Symbol" ".Sy Sequence" .It Sy Description Ta Sy Symbol Ta Sy Sequence .It newline Ta NL(LF) Ta Li \en @@ -224,10 +223,11 @@ Producing the following message: .\".St -p1003.1-2004 .\"standard. .Sh AUTHORS +.An -nosplit The Native Language Support (NLS) message catalog facility was contributed by .An J.T. Conklin -.Aq j...@netbsd.org . +.Aq Mt j...@netbsd.org . This page was originally written by .An Kee Hinckley -.Aq naz...@somewhere.com . +.Aq Mt naz...@somewhere.com .
CVS commit: src/usr.bin/gencat
Module Name:src Committed By: apb Date: Wed Nov 27 17:38:11 UTC 2013 Modified Files: src/usr.bin/gencat: gencat.c Log Message: Use LIST_FOREACH, LIST_NEXT, etc., instead of direct access to the internals of queue.h structs. To generate a diff of this commit: cvs rdiff -u -r1.35 -r1.36 src/usr.bin/gencat/gencat.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/usr.bin/gencat/gencat.c diff -u src/usr.bin/gencat/gencat.c:1.35 src/usr.bin/gencat/gencat.c:1.36 --- src/usr.bin/gencat/gencat.c:1.35 Fri Mar 9 18:54:28 2012 +++ src/usr.bin/gencat/gencat.c Wed Nov 27 17:38:11 2013 @@ -1,4 +1,4 @@ -/* $NetBSD: gencat.c,v 1.35 2012/03/09 18:54:28 ginsbach Exp $ */ +/* $NetBSD: gencat.c,v 1.36 2013/11/27 17:38:11 apb Exp $ */ /* * Copyright (c) 1996 The NetBSD Foundation, Inc. @@ -31,7 +31,7 @@ #include sys/cdefs.h #if defined(__RCSID) !defined(lint) -__RCSID($NetBSD: gencat.c,v 1.35 2012/03/09 18:54:28 ginsbach Exp $); +__RCSID($NetBSD: gencat.c,v 1.36 2013/11/27 17:38:11 apb Exp $); #endif /*** @@ -108,7 +108,7 @@ struct _setT { LIST_ENTRY(_setT) entries; }; -static LIST_HEAD(sethead, _setT) sethead; +static LIST_HEAD(sethead, _setT) sethead = LIST_HEAD_INITIALIZER(sethead); static struct _setT *curSet; static const char *curfile; @@ -470,8 +470,6 @@ MCParse(int fd) int setid = 0; charquote = 0; - /* XXX: init sethead? */ - while ((cptr = get_line(fd))) { if (*cptr == '$') { ++cptr; @@ -565,8 +563,6 @@ MCReadCat(int fd) int m, s; int msgno, setno; - /* XXX init sethead? */ - n = read(fd, cat_hdr, sizeof(cat_hdr)); if (n (ssize_t)sizeof(cat_hdr)) { if (n == 0) @@ -674,12 +670,10 @@ MCWriteCat(int fd) nmsgs = 0; string_size = 0; - for (set = sethead.lh_first; set != NULL; - set = set-entries.le_next) { + LIST_FOREACH(set, sethead, entries) { nsets++; - for (msg = set-msghead.lh_first; msg != NULL; - msg = msg-entries.le_next) { + LIST_FOREACH(msg, set-msghead, entries) { nmsgs++; string_size += strlen(msg-str) + 1; } @@ -725,12 +719,10 @@ MCWriteCat(int fd) msg_index = 0; msg_offset = 0; - for (set = sethead.lh_first; set != NULL; - set = set-entries.le_next) { + LIST_FOREACH(set, sethead, entries) { nmsgs = 0; - for (msg = set-msghead.lh_first; msg != NULL; - msg = msg-entries.le_next) { + LIST_FOREACH(msg, set-msghead, entries) { int32_t msg_len = strlen(msg-str) + 1; msg_hdr-__msgno = htonl(msg-msgId); @@ -770,9 +762,10 @@ MCAddSet(int setId) /* NOTREACHED */ } - p = sethead.lh_first; + p = LIST_FIRST(sethead); q = NULL; - for (; p != NULL p-setId setId; q = p, p = p-entries.le_next); + for (; p != NULL p-setId setId; q = p, p = LIST_NEXT(p, entries)) + continue; if (p p-setId == setId) { ; @@ -810,9 +803,10 @@ MCAddMsg(int msgId, const char *str) /* NOTREACHED */ } - p = curSet-msghead.lh_first; + p = LIST_FIRST(curSet-msghead); q = NULL; - for (; p != NULL p-msgId msgId; q = p, p = p-entries.le_next); + for (; p != NULL p-msgId msgId; q = p, p = LIST_NEXT(p, entries)) + continue; if (p p-msgId == msgId) { free(p-str); @@ -846,12 +840,13 @@ MCDelSet(int setId) /* NOTREACHED */ } - set = sethead.lh_first; - for (; set != NULL set-setId setId; set = set-entries.le_next); + set = LIST_FIRST(sethead); + for (; set != NULL set-setId setId; set = LIST_NEXT(set, entries)) + continue; if (set set-setId == setId) { LIST_REMOVE(set, entries); - while ((msg = set-msghead.lh_first) != NULL) { + while ((msg = LIST_FIRST(set-msghead)) != NULL) { LIST_REMOVE(msg, entries); free(msg-str); free(msg); @@ -870,8 +865,9 @@ MCDelMsg(int msgId) if (!curSet) error(you can't delete a message before defining the set); - msg = curSet-msghead.lh_first; - for (; msg != NULL msg-msgId msgId; msg = msg-entries.le_next); + msg = LIST_FIRST(curSet-msghead); + for (; msg != NULL msg-msgId msgId; msg = LIST_NEXT(msg, entries)) + continue; if (msg msg-msgId == msgId) { LIST_REMOVE(msg, entries);
CVS commit: src/usr.bin/gencat
Module Name:src Committed By: ginsbach Date: Fri Mar 9 18:54:28 UTC 2012 Modified Files: src/usr.bin/gencat: gencat.c Log Message: Improve the handling of quoted messages. - warn about messages with an unexpected quote character - warn about extra characters after a quote character - warn about an unterminated quoted message To generate a diff of this commit: cvs rdiff -u -r1.34 -r1.35 src/usr.bin/gencat/gencat.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/usr.bin/gencat/gencat.c diff -u src/usr.bin/gencat/gencat.c:1.34 src/usr.bin/gencat/gencat.c:1.35 --- src/usr.bin/gencat/gencat.c:1.34 Thu Dec 29 22:58:27 2011 +++ src/usr.bin/gencat/gencat.c Fri Mar 9 18:54:28 2012 @@ -1,4 +1,4 @@ -/* $NetBSD: gencat.c,v 1.34 2011/12/29 22:58:27 wiz Exp $ */ +/* $NetBSD: gencat.c,v 1.35 2012/03/09 18:54:28 ginsbach Exp $ */ /* * Copyright (c) 1996 The NetBSD Foundation, Inc. @@ -31,7 +31,7 @@ #include sys/cdefs.h #if defined(__RCSID) !defined(lint) -__RCSID($NetBSD: gencat.c,v 1.34 2011/12/29 22:58:27 wiz Exp $); +__RCSID($NetBSD: gencat.c,v 1.35 2012/03/09 18:54:28 ginsbach Exp $); #endif /*** @@ -345,11 +345,13 @@ getmsg(int fd, char *cptr, char quote) { static char *msg = NULL; static size_t msglen = 0; - size_tclen, i; + size_t clen, i; + int in_quote = 0; char *tptr; if (quote *cptr == quote) { ++cptr; + in_quote = 1; } clen = strlen(cptr) + 1; @@ -366,11 +368,26 @@ getmsg(int fd, char *cptr, char quote) if (quote *cptr == quote) { char *tmp; tmp = cptr + 1; - if (*tmp (!isspace((unsigned char) *tmp) || *wskip(tmp))) { + if (!in_quote) { +/* XXX hard error? */ warning(cptr, unexpected quote character, ignoring); *tptr++ = *cptr++; } else { -*cptr = '\0'; +cptr++; +/* don't use wskip() */ +while (*cptr isspace((unsigned char) *cptr)) +#ifndef _BACKWARDS_COMPAT + cptr++; +#else + *tptr++ = *cptr++; +#endif +/* XXX hard error? */ +if (*cptr) + warning(tmp, unexpected extra characters, ignoring); +in_quote = 0; +#ifndef _BACKWARDS_COMPAT +break; +#endif } } else { if (*cptr == '\\') { @@ -437,6 +454,10 @@ getmsg(int fd, char *cptr, char quote) } } } + + if (in_quote) + warning(cptr, unterminated quoted message, ignoring); + *tptr = '\0'; return (msg); }
CVS commit: src/usr.bin/gencat
Module Name:src Committed By: christos Date: Thu Dec 29 16:41:38 UTC 2011 Modified Files: src/usr.bin/gencat: gencat.1 gencat.c Log Message: Make msgfile optional like other OS's To generate a diff of this commit: cvs rdiff -u -r1.12 -r1.13 src/usr.bin/gencat/gencat.1 cvs rdiff -u -r1.32 -r1.33 src/usr.bin/gencat/gencat.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/usr.bin/gencat/gencat.1 diff -u src/usr.bin/gencat/gencat.1:1.12 src/usr.bin/gencat/gencat.1:1.13 --- src/usr.bin/gencat/gencat.1:1.12 Mon Mar 9 15:24:32 2009 +++ src/usr.bin/gencat/gencat.1 Thu Dec 29 11:41:38 2011 @@ -1,4 +1,4 @@ -.\ $NetBSD: gencat.1,v 1.12 2009/03/09 19:24:32 joerg Exp $ +.\ $NetBSD: gencat.1,v 1.13 2011/12/29 16:41:38 christos Exp $ .\ .\ Copyright (c) 2007 The NetBSD Foundation, Inc. .\ All rights reserved. @@ -29,7 +29,7 @@ .\ .\ Written by Kee Hinckley naz...@somewhere.com .\ -.Dd November 4, 2008 +.Dd December 29, 2011 .Dt GENCAT 1 .Os .Sh NAME @@ -38,14 +38,13 @@ .Sh SYNOPSIS .Nm .Ar catfile -.Ar msgfile -.Op Ar msgfile ... +.Op Ar msgfile|- ... .Sh DESCRIPTION The .Nm utility generates a formatted message catalog .Ar catfile -from one or more message source text files +from stdin or one or more message source text files .Ar msgfile . The file .Ar catfile Index: src/usr.bin/gencat/gencat.c diff -u src/usr.bin/gencat/gencat.c:1.32 src/usr.bin/gencat/gencat.c:1.33 --- src/usr.bin/gencat/gencat.c:1.32 Wed Sep 21 10:33:35 2011 +++ src/usr.bin/gencat/gencat.c Thu Dec 29 11:41:38 2011 @@ -1,4 +1,4 @@ -/* $NetBSD: gencat.c,v 1.32 2011/09/21 14:33:35 christos Exp $ */ +/* $NetBSD: gencat.c,v 1.33 2011/12/29 16:41:38 christos Exp $ */ /* * Copyright (c) 1996 The NetBSD Foundation, Inc. @@ -31,7 +31,7 @@ #include sys/cdefs.h #if defined(__RCSID) !defined(lint) -__RCSID($NetBSD: gencat.c,v 1.32 2011/09/21 14:33:35 christos Exp $); +__RCSID($NetBSD: gencat.c,v 1.33 2011/12/29 16:41:38 christos Exp $); #endif /*** @@ -163,7 +163,7 @@ main(int argc, char *argv[]) argc -= optind; argv += optind; - if (argc 2) { + if (argc 1) { usage(); /* NOTREACHED */ } @@ -193,8 +193,8 @@ main(int argc, char *argv[]) } } - if (((*argv)[0] == '-') ((*argv)[1] == '\0')) { - if (argc != 2) + if (argc 2 || (((*argv)[0] == '-') ((*argv)[1] == '\0'))) { + if (argc 2) usage(); /* NOTREACHED */ MCParse(STDIN_FILENO);
CVS commit: src/usr.bin/gencat
Module Name:src Committed By: wiz Date: Thu Dec 29 22:58:27 UTC 2011 Modified Files: src/usr.bin/gencat: gencat.c Log Message: Make usage() match man page. To generate a diff of this commit: cvs rdiff -u -r1.33 -r1.34 src/usr.bin/gencat/gencat.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/usr.bin/gencat/gencat.c diff -u src/usr.bin/gencat/gencat.c:1.33 src/usr.bin/gencat/gencat.c:1.34 --- src/usr.bin/gencat/gencat.c:1.33 Thu Dec 29 16:41:38 2011 +++ src/usr.bin/gencat/gencat.c Thu Dec 29 22:58:27 2011 @@ -1,4 +1,4 @@ -/* $NetBSD: gencat.c,v 1.33 2011/12/29 16:41:38 christos Exp $ */ +/* $NetBSD: gencat.c,v 1.34 2011/12/29 22:58:27 wiz Exp $ */ /* * Copyright (c) 1996 The NetBSD Foundation, Inc. @@ -31,7 +31,7 @@ #include sys/cdefs.h #if defined(__RCSID) !defined(lint) -__RCSID($NetBSD: gencat.c,v 1.33 2011/12/29 16:41:38 christos Exp $); +__RCSID($NetBSD: gencat.c,v 1.34 2011/12/29 22:58:27 wiz Exp $); #endif /*** @@ -140,7 +140,7 @@ __dead static void usage(void); static void usage(void) { - fprintf(stderr, usage: %s catfile msgfile ...\n, getprogname()); + fprintf(stderr, usage: %s catfile [msgfile|- ...]\n, getprogname()); exit(1); }
CVS commit: src/usr.bin/gencat
Module Name:src Committed By: christos Date: Wed Sep 21 14:33:35 UTC 2011 Modified Files: src/usr.bin/gencat: gencat.c Log Message: PR/45385: Henning Petersen: Swapped arguments in lseek To generate a diff of this commit: cvs rdiff -u -r1.31 -r1.32 src/usr.bin/gencat/gencat.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/usr.bin/gencat/gencat.c diff -u src/usr.bin/gencat/gencat.c:1.31 src/usr.bin/gencat/gencat.c:1.32 --- src/usr.bin/gencat/gencat.c:1.31 Sun Sep 4 16:27:05 2011 +++ src/usr.bin/gencat/gencat.c Wed Sep 21 10:33:35 2011 @@ -1,4 +1,4 @@ -/* $NetBSD: gencat.c,v 1.31 2011/09/04 20:27:05 joerg Exp $ */ +/* $NetBSD: gencat.c,v 1.32 2011/09/21 14:33:35 christos Exp $ */ /* * Copyright (c) 1996 The NetBSD Foundation, Inc. @@ -31,7 +31,7 @@ #include sys/cdefs.h #if defined(__RCSID) !defined(lint) -__RCSID($NetBSD: gencat.c,v 1.31 2011/09/04 20:27:05 joerg Exp $); +__RCSID($NetBSD: gencat.c,v 1.32 2011/09/21 14:33:35 christos Exp $); #endif /*** @@ -186,7 +186,7 @@ curfile = catfile; updatecat = 1; MCReadCat(ofd); - if (lseek(ofd, SEEK_SET, 0) 0) { + if (lseek(ofd, (off_t)0, SEEK_SET) == (off_t)-1) { err(1, Unable to seek on %s, catfile); /* NOTREACHED */ }
CVS commit: src/usr.bin/gencat
Module Name:src Committed By: joerg Date: Sun Sep 4 20:27:05 UTC 2011 Modified Files: src/usr.bin/gencat: gencat.c Log Message: static + __dead To generate a diff of this commit: cvs rdiff -u -r1.30 -r1.31 src/usr.bin/gencat/gencat.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/usr.bin/gencat/gencat.c diff -u src/usr.bin/gencat/gencat.c:1.30 src/usr.bin/gencat/gencat.c:1.31 --- src/usr.bin/gencat/gencat.c:1.30 Mon Jul 13 19:05:41 2009 +++ src/usr.bin/gencat/gencat.c Sun Sep 4 20:27:05 2011 @@ -1,4 +1,4 @@ -/* $NetBSD: gencat.c,v 1.30 2009/07/13 19:05:41 roy Exp $ */ +/* $NetBSD: gencat.c,v 1.31 2011/09/04 20:27:05 joerg Exp $ */ /* * Copyright (c) 1996 The NetBSD Foundation, Inc. @@ -31,7 +31,7 @@ #include sys/cdefs.h #if defined(__RCSID) !defined(lint) -__RCSID($NetBSD: gencat.c,v 1.30 2009/07/13 19:05:41 roy Exp $); +__RCSID($NetBSD: gencat.c,v 1.31 2011/09/04 20:27:05 joerg Exp $); #endif /*** @@ -108,7 +108,7 @@ LIST_ENTRY(_setT) entries; }; -LIST_HEAD(sethead, _setT) sethead; +static LIST_HEAD(sethead, _setT) sethead; static struct _setT *curSet; static const char *curfile; @@ -116,7 +116,7 @@ static long lineno = 0; static char *cskip(char *); -static void error(const char *); +__dead static void error(const char *); static char *get_line(int); static char *getmsg(int, char *, char); static void warning(const char *, const char *); @@ -125,20 +125,19 @@ static void *xmalloc(size_t); static void *xrealloc(void *, size_t); -void MCParse(int fd); -void MCReadCat(int fd); -void MCWriteCat(int fd); -void MCDelMsg(int msgId); -void MCAddMsg(int msgId, const char *msg); -void MCAddSet(int setId); -void MCDelSet(int setId); -int main(int, char **); -void usage(void); +static void MCParse(int fd); +static void MCReadCat(int fd); +static void MCWriteCat(int fd); +static void MCDelMsg(int msgId); +static void MCAddMsg(int msgId, const char *msg); +static void MCAddSet(int setId); +static void MCDelSet(int setId); +__dead static void usage(void); #define CORRUPT corrupt message catalog #define NOMEMORY out of memory -void +static void usage(void) { fprintf(stderr, usage: %s catfile msgfile ...\n, getprogname()); @@ -442,7 +441,7 @@ return (msg); } -void +static void MCParse(int fd) { char *cptr, *str; @@ -533,7 +532,7 @@ } } -void +static void MCReadCat(int fd) { void *msgcat; /* message catalog data */ @@ -631,7 +630,7 @@ * avoids additional housekeeping variables and/or a lot of seeks * that would otherwise be required. */ -void +static void MCWriteCat(int fd) { int nsets; /* number of sets */ @@ -736,7 +735,7 @@ write(fd, msgcat, msgcat_size); } -void +static void MCAddSet(int setId) { struct _setT *p, *q; @@ -773,7 +772,7 @@ curSet = p; } -void +static void MCAddMsg(int msgId, const char *str) { struct _msgT *p, *q; @@ -811,7 +810,7 @@ p-str = xstrdup(str); } -void +static void MCDelSet(int setId) { struct _setT *set; @@ -842,7 +841,7 @@ warning(NULL, specified set doesn't exist); } -void +static void MCDelMsg(int msgId) { struct _msgT *msg;
CVS commit: src/usr.bin/gencat
Module Name:src Committed By: tron Date: Thu Apr 16 13:52:52 UTC 2009 Modified Files: src/usr.bin/gencat: gencat.c Log Message: Fix build problem on big endian ports where ntohl() doesn't convert the argument to uint32_t automatically. To generate a diff of this commit: cvs rdiff -u -r1.28 -r1.29 src/usr.bin/gencat/gencat.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/usr.bin/gencat/gencat.c diff -u src/usr.bin/gencat/gencat.c:1.28 src/usr.bin/gencat/gencat.c:1.29 --- src/usr.bin/gencat/gencat.c:1.28 Sun Apr 12 10:25:35 2009 +++ src/usr.bin/gencat/gencat.c Thu Apr 16 13:52:52 2009 @@ -1,4 +1,4 @@ -/* $NetBSD: gencat.c,v 1.28 2009/04/12 10:25:35 lukem Exp $ */ +/* $NetBSD: gencat.c,v 1.29 2009/04/16 13:52:52 tron Exp $ */ /* * Copyright (c) 1996 The NetBSD Foundation, Inc. @@ -31,7 +31,7 @@ #include sys/cdefs.h #if defined(__RCSID) !defined(lint) -__RCSID($NetBSD: gencat.c,v 1.28 2009/04/12 10:25:35 lukem Exp $); +__RCSID($NetBSD: gencat.c,v 1.29 2009/04/16 13:52:52 tron Exp $); #endif /*** @@ -556,7 +556,7 @@ else errx(1, CORRUPT); } - if (ntohl(cat_hdr.__magic) != _NLS_MAGIC) + if (ntohl((uint32_t)cat_hdr.__magic) != _NLS_MAGIC) errx(1, %s: bad magic number (%#x), CORRUPT, cat_hdr.__magic); cat_hdr.__mem = ntohl(cat_hdr.__mem);
CVS commit: src/usr.bin/gencat
Module Name:src Committed By: lukem Date: Sun Apr 12 10:25:35 UTC 2009 Modified Files: src/usr.bin/gencat: gencat.c Log Message: fix sign-compare issues To generate a diff of this commit: cvs rdiff -u -r1.27 -r1.28 src/usr.bin/gencat/gencat.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/usr.bin/gencat/gencat.c diff -u src/usr.bin/gencat/gencat.c:1.27 src/usr.bin/gencat/gencat.c:1.28 --- src/usr.bin/gencat/gencat.c:1.27 Wed Feb 18 20:04:43 2009 +++ src/usr.bin/gencat/gencat.c Sun Apr 12 10:25:35 2009 @@ -1,4 +1,4 @@ -/* $NetBSD: gencat.c,v 1.27 2009/02/18 20:04:43 christos Exp $ */ +/* $NetBSD: gencat.c,v 1.28 2009/04/12 10:25:35 lukem Exp $ */ /* * Copyright (c) 1996 The NetBSD Foundation, Inc. @@ -31,7 +31,7 @@ #include sys/cdefs.h #if defined(__RCSID) !defined(lint) -__RCSID($NetBSD: gencat.c,v 1.27 2009/02/18 20:04:43 christos Exp $); +__RCSID($NetBSD: gencat.c,v 1.28 2009/04/12 10:25:35 lukem Exp $); #endif /*** @@ -345,7 +345,7 @@ getmsg(int fd, char *cptr, char quote) { static char *msg = NULL; - static long msglen = 0; + static size_t msglen = 0; size_tclen, i; char *tptr; @@ -541,13 +541,14 @@ struct _nls_set_hdr *set_hdr; struct _nls_msg_hdr *msg_hdr; char *strings; - int m, n, s; + ssize_t n; + int m, s; int msgno, setno; /* XXX init sethead? */ n = read(fd, cat_hdr, sizeof(cat_hdr)); - if (n sizeof(cat_hdr)) { + if (n (ssize_t)sizeof(cat_hdr)) { if (n == 0) return; /* empty file */ else if (n == -1) @@ -566,7 +567,7 @@ if ((cat_hdr.__mem 0) || (cat_hdr.__msg_hdr_offset 0) || (cat_hdr.__msg_txt_offset 0) || - (cat_hdr.__mem (cat_hdr.__nsets * sizeof(struct _nls_set_hdr))) || + (cat_hdr.__mem (int32_t)(cat_hdr.__nsets * sizeof(struct _nls_set_hdr))) || (cat_hdr.__mem cat_hdr.__msg_hdr_offset) || (cat_hdr.__mem cat_hdr.__msg_txt_offset)) errx(1, %s: catalog header, CORRUPT); @@ -710,7 +711,7 @@ nmsgs = 0; for (msg = set-msghead.lh_first; msg != NULL; msg = msg-entries.le_next) { - int msg_len = strlen(msg-str) + 1; + int32_t msg_len = strlen(msg-str) + 1; msg_hdr-__msgno = htonl(msg-msgId); msg_hdr-__msglen = htonl(msg_len);