summaryrefslogtreecommitdiff
path: root/usr/src
diff options
context:
space:
mode:
Diffstat (limited to 'usr/src')
-rw-r--r--usr/src/cmd/localedef/Makefile2
-rw-r--r--usr/src/cmd/localedef/charmap.c19
-rw-r--r--usr/src/cmd/localedef/collate.c20
-rw-r--r--usr/src/cmd/localedef/ctype.c8
-rw-r--r--usr/src/cmd/localedef/localedef.h5
-rw-r--r--usr/src/cmd/localedef/parser.y21
-rw-r--r--usr/src/cmd/localedef/scanner.c2
-rw-r--r--usr/src/cmd/localedef/time.c2
-rw-r--r--usr/src/cmd/localedef/wide.c2
9 files changed, 39 insertions, 42 deletions
diff --git a/usr/src/cmd/localedef/Makefile b/usr/src/cmd/localedef/Makefile
index bb4b492abc..9cb289c1a5 100644
--- a/usr/src/cmd/localedef/Makefile
+++ b/usr/src/cmd/localedef/Makefile
@@ -33,8 +33,6 @@ SRCS = $(OBJS:%.o=%.c)
CPPFLAGS += -I $(SRC)/lib/libc/port/locale
NATIVE_CPPFLAGS += -I $(SRC)/lib/libc/port/locale -DNATIVE
-CERRWARN += -_gcc=-Wno-char-subscripts
-CERRWARN += -_gcc=-Wno-uninitialized
CERRWARN += -_gcc=-Wno-unused-label
LDLIBS += -lgen
LDLIBS += -lavl
diff --git a/usr/src/cmd/localedef/charmap.c b/usr/src/cmd/localedef/charmap.c
index 69e4839319..d93dae2c85 100644
--- a/usr/src/cmd/localedef/charmap.c
+++ b/usr/src/cmd/localedef/charmap.c
@@ -43,7 +43,7 @@ typedef struct charmap {
* Array of POSIX specific portable characters.
*/
static const struct {
- char *name;
+ const char *name;
int ch;
} portable_chars[] = {
{ "NUL", '\0' },
@@ -191,7 +191,7 @@ init_charmap(void)
}
static void
-add_charmap_impl(char *sym, wchar_t wc, int nodups)
+add_charmap_impl(const char *sym, wchar_t wc, int nodups)
{
charmap_t srch;
charmap_t *n = NULL;
@@ -204,7 +204,8 @@ add_charmap_impl(char *sym, wchar_t wc, int nodups)
* also possibly insert the wide mapping, although note that there
* can only be one of these per wide character code.
*/
- if ((wc != -1) && ((avl_find(&cmap_wc, &srch, &where)) == NULL)) {
+ if ((wc != (wchar_t)-1) &&
+ ((avl_find(&cmap_wc, &srch, &where)) == NULL)) {
if ((n = calloc(1, sizeof (*n))) == NULL) {
errf(_("out of memory"));
return;
@@ -232,7 +233,7 @@ add_charmap_impl(char *sym, wchar_t wc, int nodups)
}
void
-add_charmap(char *sym, int c)
+add_charmap(const char *sym, int c)
{
add_charmap_impl(sym, c, 1);
}
@@ -246,7 +247,7 @@ add_charmap_undefined(char *sym)
srch.name = sym;
cm = avl_find(&cmap_sym, &srch, NULL);
- if ((undefok == 0) && ((cm == NULL) || (cm->wc == -1))) {
+ if ((undefok == 0) && ((cm == NULL) || (cm->wc == (wchar_t)-1))) {
warn(_("undefined symbol <%s>"), sym);
add_charmap_impl(sym, -1, 0);
} else {
@@ -294,19 +295,19 @@ add_charmap_range(char *s, char *e, int wc)
}
void
-add_charmap_char(char *name, int val)
+add_charmap_char(const char *name, int val)
{
add_charmap_impl(name, val, 0);
}
/*
* POSIX insists that certain entries be present, even when not in the
- * orginal charmap file.
+ * original charmap file.
*/
void
add_charmap_posix(void)
{
- char i;
+ int i;
for (i = 0; portable_chars[i].name; i++) {
add_charmap_char(portable_chars[i].name, portable_chars[i].ch);
@@ -321,7 +322,7 @@ lookup_charmap(const char *sym, wchar_t *wc)
srch.name = sym;
n = avl_find(&cmap_sym, &srch, NULL);
- if (n && n->wc != -1) {
+ if (n && n->wc != (wchar_t)-1) {
if (wc)
*wc = n->wc;
return (0);
diff --git a/usr/src/cmd/localedef/collate.c b/usr/src/cmd/localedef/collate.c
index e71d55abe8..a55c823f3b 100644
--- a/usr/src/cmd/localedef/collate.c
+++ b/usr/src/cmd/localedef/collate.c
@@ -465,7 +465,7 @@ define_collsym(char *name)
collsym_t *sym;
avl_index_t where;
- if ((sym = calloc(sizeof (*sym), 1)) == NULL) {
+ if ((sym = calloc(1, sizeof (*sym))) == NULL) {
errf(_("out of memory"));
return;
}
@@ -512,7 +512,7 @@ get_collundef(char *name)
srch.name = name;
if ((ud = avl_find(&collundefs, &srch, &where)) == NULL) {
- if (((ud = calloc(sizeof (*ud), 1)) == NULL) ||
+ if (((ud = calloc(1, sizeof (*ud))) == NULL) ||
((ud->name = strdup(name)) == NULL)) {
errf(_("out of memory"));
free(ud);
@@ -538,7 +538,7 @@ get_collchar(wchar_t wc, int create)
srch.wc = wc;
cc = avl_find(&collchars, &srch, &where);
if ((cc == NULL) && create) {
- if ((cc = calloc(sizeof (*cc), 1)) == NULL) {
+ if ((cc = calloc(1, sizeof (*cc))) == NULL) {
errf(_("out of memory"));
return (NULL);
}
@@ -772,7 +772,7 @@ define_collelem(char *name, wchar_t *wcs)
return;
}
- if ((e = calloc(sizeof (*e), 1)) == NULL) {
+ if ((e = calloc(1, sizeof (*e))) == NULL) {
errf(_("out of memory"));
return;
}
@@ -907,7 +907,7 @@ add_order_subst(void)
s = avl_find(&substs_ref[curr_weight], &srch, &where);
if (s == NULL) {
- if ((s = calloc(sizeof (*s), 1)) == NULL) {
+ if ((s = calloc(1, sizeof (*s))) == NULL) {
errf(_("out of memory"));
return;
}
@@ -1016,7 +1016,7 @@ add_weight(int32_t ref, int pass)
if (avl_find(&weights[pass], &srch, &where) != NULL)
return;
- if ((w = calloc(sizeof (*w), 1)) == NULL) {
+ if ((w = calloc(1, sizeof (*w))) == NULL) {
errf(_("out of memory"));
return;
}
@@ -1072,7 +1072,7 @@ dump_collate(void)
collate_chain_t *chain;
/*
- * We have to run throught a preliminary pass to identify all the
+ * We have to run through a preliminary pass to identify all the
* weights that we use for each sorting level.
*/
for (i = 0; i < NUM_WT; i++) {
@@ -1158,7 +1158,7 @@ dump_collate(void)
for (i = 0; i < NUM_WT; i++) {
collate_subst_t *st = NULL;
n = collinfo.subst_count[i] = avl_numnodes(&substs[i]);
- if ((st = calloc(sizeof (collate_subst_t) * n, 1)) == NULL) {
+ if ((st = calloc(n, sizeof (collate_subst_t))) == NULL) {
errf(_("out of memory"));
return;
}
@@ -1187,7 +1187,7 @@ dump_collate(void)
* Chains, i.e. collating elements
*/
collinfo.chain_count = avl_numnodes(&elem_by_expand);
- chain = calloc(sizeof (collate_chain_t), collinfo.chain_count);
+ chain = calloc(collinfo.chain_count, sizeof (collate_chain_t));
if (chain == NULL) {
errf(_("out of memory"));
return;
@@ -1206,7 +1206,7 @@ dump_collate(void)
/*
* Large (> UCHAR_MAX) character priorities
*/
- large = calloc(sizeof (collate_large_t) * avl_numnodes(&collchars), 1);
+ large = calloc(avl_numnodes(&collchars), sizeof (collate_large_t));
if (large == NULL) {
errf(_("out of memory"));
return;
diff --git a/usr/src/cmd/localedef/ctype.c b/usr/src/cmd/localedef/ctype.c
index 1f40f49ca0..d4778d2f10 100644
--- a/usr/src/cmd/localedef/ctype.c
+++ b/usr/src/cmd/localedef/ctype.c
@@ -166,7 +166,7 @@ add_ctype(int val)
}
void
-add_ctype_range(int end)
+add_ctype_range(wchar_t end)
{
ctype_node_t *ctn;
wchar_t cur;
@@ -377,9 +377,9 @@ dump_ctype(void)
continue;
}
- if ((last_ct != NULL) && (last_ct->ctype == ctn->ctype)) {
+ if ((last_ct != NULL) && (last_ct->ctype == ctn->ctype) &&
+ (last_ct->wc + 1 == wc)) {
ct[rl.runetype_ext_nranges-1].max = wc;
- last_ct = ctn;
} else {
rl.runetype_ext_nranges++;
ct = realloc(ct,
@@ -389,8 +389,8 @@ dump_ctype(void)
ct[rl.runetype_ext_nranges - 1].min = wc;
ct[rl.runetype_ext_nranges - 1].max = wc;
ct[rl.runetype_ext_nranges - 1].map = ctn->ctype;
- last_ct = ctn;
}
+ last_ct = ctn;
if (ctn->tolower == 0) {
last_lo = NULL;
} else if ((last_lo != NULL) &&
diff --git a/usr/src/cmd/localedef/localedef.h b/usr/src/cmd/localedef/localedef.h
index 5638f13d6e..7a6acf7046 100644
--- a/usr/src/cmd/localedef/localedef.h
+++ b/usr/src/cmd/localedef/localedef.h
@@ -56,10 +56,11 @@ wchar_t *get_wcs(void);
/* charmap.c - CHARMAP handling */
void init_charmap(void);
-void add_charmap(char *, int);
+void add_charmap(const char *, int);
void add_charmap_undefined(char *);
void add_charmap_posix(void);
void add_charmap_range(char *, char *, int);
+void add_charmap_char(const char *name, int val);
int lookup_charmap(const char *, wchar_t *);
int check_charmap_undefined(char *);
int check_charmap(wchar_t);
@@ -98,7 +99,7 @@ void add_subst_symbol(char *);
/* ctype.c - LC_CTYPE handling */
void init_ctype(void);
void add_ctype(int);
-void add_ctype_range(int);
+void add_ctype_range(wchar_t);
void add_width(int, int);
void add_width_range(int, int, int);
void add_caseconv(int, int);
diff --git a/usr/src/cmd/localedef/parser.y b/usr/src/cmd/localedef/parser.y
index 9a7fa80f7f..ae3a827ae6 100644
--- a/usr/src/cmd/localedef/parser.y
+++ b/usr/src/cmd/localedef/parser.y
@@ -307,21 +307,18 @@ ctype_kw : T_ISUPPER cc_list T_NL
| T_TOLOWER conv_list T_NL
;
+cc_list : cc_list T_SEMI cc_range_end
+ | cc_list T_SEMI cc_char
+ | cc_char
+ ;
-cc_list : cc_list T_SEMI T_CHAR
+cc_range_end : T_ELLIPSIS T_SEMI T_CHAR
{
- add_ctype($3);
+ add_ctype_range($3);
}
- | cc_list T_SEMI T_SYMBOL
- {
- add_charmap_undefined($3);
- }
- | cc_list T_SEMI T_ELLIPSIS T_SEMI T_CHAR
- {
- /* note that the endpoints *must* be characters */
- add_ctype_range($5);
- }
- | T_CHAR
+ ;
+
+cc_char : T_CHAR
{
add_ctype($1);
}
diff --git a/usr/src/cmd/localedef/scanner.c b/usr/src/cmd/localedef/scanner.c
index 61b8fb067e..e5cacfd2ee 100644
--- a/usr/src/cmd/localedef/scanner.c
+++ b/usr/src/cmd/localedef/scanner.c
@@ -163,7 +163,7 @@ static struct token {
/*
* These are keywords used in the charmap file. Note that
- * Solaris orginally used angle brackets to wrap some of them,
+ * Solaris originally used angle brackets to wrap some of them,
* but we removed that to simplify our parser. The first of these
* items are "global items."
*/
diff --git a/usr/src/cmd/localedef/time.c b/usr/src/cmd/localedef/time.c
index ab2d27d295..071f281655 100644
--- a/usr/src/cmd/localedef/time.c
+++ b/usr/src/cmd/localedef/time.c
@@ -247,7 +247,7 @@ dump_time(void)
* NOTE: If date_fmt is not specified, then we'll default to
* using the %c for date. This is reasonable for most
* locales, although for reasons that I don't understand
- * Solaris historically has had a seperate format for date.
+ * Solaris historically has had a separate format for date.
*/
if ((putl_category(tm.X_fmt, f) == EOF) ||
(putl_category(tm.x_fmt, f) == EOF) ||
diff --git a/usr/src/cmd/localedef/wide.c b/usr/src/cmd/localedef/wide.c
index b1b2cd2438..0d5bf102f0 100644
--- a/usr/src/cmd/localedef/wide.c
+++ b/usr/src/cmd/localedef/wide.c
@@ -464,7 +464,7 @@ towide_euc_impl(wchar_t *wc, const char *mb, unsigned n,
uint8_t cs2, uint8_t cs2width, uint8_t cs3, uint8_t cs3width)
{
int i;
- int width;
+ int width = 2;
wchar_t c;
c = *(uint8_t *)mb;