summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--gettext-runtime/intl/ChangeLog16
-rw-r--r--gettext-runtime/intl/dcigettext.c7
-rw-r--r--gettext-runtime/intl/gettextP.h6
-rw-r--r--gettext-runtime/intl/gmo.h19
-rw-r--r--gettext-runtime/intl/loadmsgcat.c3
-rw-r--r--gettext-runtime/intl/localealias.c12
-rw-r--r--gettext-runtime/intl/plural-exp.c4
-rw-r--r--gettext-runtime/intl/plural-exp.h52
-rw-r--r--gettext-runtime/intl/plural.y16
-rw-r--r--gettext-tools/libgrep/ChangeLog25
-rw-r--r--gettext-tools/libgrep/dfa.c84
-rw-r--r--gettext-tools/libgrep/dfa.h7
-rw-r--r--gettext-tools/libgrep/kwset.c6
-rw-r--r--gettext-tools/libgrep/m-fgrep.c16
-rw-r--r--gettext-tools/libgrep/m-regex.c26
-rw-r--r--gettext-tools/libgrep/regex.c51
-rw-r--r--gettext-tools/src/ChangeLog28
-rw-r--r--gettext-tools/src/dir-list.c4
-rw-r--r--gettext-tools/src/format-c.c19
-rw-r--r--gettext-tools/src/format-gcc-internal.c17
-rw-r--r--gettext-tools/src/format-lisp.c21
-rw-r--r--gettext-tools/src/format-perl.c17
-rw-r--r--gettext-tools/src/format-scheme.c21
-rw-r--r--gettext-tools/src/message.h22
-rw-r--r--gettext-tools/src/msgl-equal.c8
-rw-r--r--gettext-tools/src/po-lex.c10
-rw-r--r--gettext-tools/src/read-mo.c8
-rw-r--r--gettext-tools/src/read-po.c6
-rw-r--r--gettext-tools/src/read-properties.c6
-rw-r--r--gettext-tools/src/write-mo.c4
-rw-r--r--gettext-tools/src/x-glade.c48
-rw-r--r--gettext-tools/src/x-perl.c2
-rw-r--r--gettext-tools/src/x-po.c36
-rw-r--r--gettext-tools/src/x-smalltalk.c4
-rw-r--r--gnulib-local/ChangeLog8
-rw-r--r--gnulib-local/lib/backupfile.c3
-rw-r--r--gnulib-local/lib/xalloc.h9
-rw-r--r--gnulib-local/lib/xstrdup.c2
38 files changed, 414 insertions, 239 deletions
diff --git a/gettext-runtime/intl/ChangeLog b/gettext-runtime/intl/ChangeLog
index 3d7b187..2b7f3c8 100644
--- a/gettext-runtime/intl/ChangeLog
+++ b/gettext-runtime/intl/ChangeLog
@@ -1,3 +1,19 @@
+2006-10-29 Bruno Haible <bruno@clisp.org>
+
+ Make it compile in C++ mode.
+ * gettextP.h (SWAP): Don't use K&R syntax in C++ mode.
+ * gmo.h (struct segment_pair): Move out of the scope of struct
+ sysdep_string.
+ * dcigettext.c (DCIGETTEXT): Cast mempcpy results.
+ * loadmsgcat.c (_nl_load_domain): Cast alloca result.
+ * localealias.c (read_alias_file): Cast memcpy result.
+ * plural-exp.h (enum expression_operator): Move out of the scope of
+ struct expression. Rename from 'enum operator'.
+ * plural-exp.c (plvar, plone, GERMANIC_PLURAL): Don't use C99 named
+ initializer syntax in C++ mode.
+ * plural.y (%union, new_exp, new_exp_0, new_exp_1, new_exp_2,
+ new_exp_3): Update.
+
2006-10-26 Bruno Haible <bruno@clisp.org>
* gettext-0.16 released.
diff --git a/gettext-runtime/intl/dcigettext.c b/gettext-runtime/intl/dcigettext.c
index 5839768..c3cf6eb 100644
--- a/gettext-runtime/intl/dcigettext.c
+++ b/gettext-runtime/intl/dcigettext.c
@@ -683,8 +683,8 @@ DCIGETTEXT (const char *domainname, const char *msgid1, const char *msgid2,
+ domainname_len + 5);
ADD_BLOCK (block_list, xdomainname);
- stpcpy (mempcpy (stpcpy (stpcpy (xdomainname, categoryname), "/"),
- domainname, domainname_len),
+ stpcpy ((char *) mempcpy (stpcpy (stpcpy (xdomainname, categoryname), "/"),
+ domainname, domainname_len),
".mo");
/* Creating working area. */
@@ -793,7 +793,8 @@ DCIGETTEXT (const char *domainname, const char *msgid1, const char *msgid2,
char *new_localename;
# endif
- new_domainname = mempcpy (newp->msgid, msgid1, msgid_len);
+ new_domainname =
+ (char *) mempcpy (newp->msgid, msgid1, msgid_len);
memcpy (new_domainname, domainname, domainname_len + 1);
# ifdef HAVE_PER_THREAD_LOCALE
new_localename = new_domainname + domainname_len + 1;
diff --git a/gettext-runtime/intl/gettextP.h b/gettext-runtime/intl/gettextP.h
index 8be38d2..2c08d41 100644
--- a/gettext-runtime/intl/gettextP.h
+++ b/gettext-runtime/intl/gettextP.h
@@ -1,5 +1,5 @@
/* Header describing internals of libintl library.
- Copyright (C) 1995-1999, 2000-2005 Free Software Foundation, Inc.
+ Copyright (C) 1995-1999, 2000-2006 Free Software Foundation, Inc.
Written by Ulrich Drepper <drepper@cygnus.com>, 1995.
This program is free software; you can redistribute it and/or modify it
@@ -106,8 +106,12 @@ extern char *libintl_dcigettext (const char *__domainname,
# define SWAP(i) bswap_32 (i)
#else
static inline nls_uint32
+# ifdef __cplusplus
+SWAP (nls_uint32 i)
+# else
SWAP (i)
nls_uint32 i;
+# endif
{
return (i << 24) | ((i & 0xff00) << 8) | ((i >> 8) & 0xff00) | (i >> 24);
}
diff --git a/gettext-runtime/intl/gmo.h b/gettext-runtime/intl/gmo.h
index 26515fe..da9dbaa 100644
--- a/gettext-runtime/intl/gmo.h
+++ b/gettext-runtime/intl/gmo.h
@@ -1,5 +1,5 @@
/* Description of GNU message catalog format: general file layout.
- Copyright (C) 1995, 1997, 2000-2002, 2004 Free Software Foundation, Inc.
+ Copyright (C) 1995, 1997, 2000-2002, 2004, 2006 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify it
under the terms of the GNU Library General Public License as published
@@ -124,6 +124,15 @@ struct sysdep_segment
nls_uint32 offset;
};
+/* Pair of a static and a system dependent segment, in struct sysdep_string. */
+struct segment_pair
+{
+ /* Size of static segment. */
+ nls_uint32 segsize;
+ /* Reference to system dependent string segment, or ~0 at the end. */
+ nls_uint32 sysdepref;
+};
+
/* Descriptor for system dependent string. */
struct sysdep_string
{
@@ -131,13 +140,7 @@ struct sysdep_string
nls_uint32 offset;
/* Alternating sequence of static and system dependent segments.
The last segment is a static segment, including the trailing NUL. */
- struct segment_pair
- {
- /* Size of static segment. */
- nls_uint32 segsize;
- /* Reference to system dependent string segment, or ~0 at the end. */
- nls_uint32 sysdepref;
- } segments[1];
+ struct segment_pair segments[1];
};
/* Marker for the end of the segments[] array. This has the value 0xFFFFFFFF,
diff --git a/gettext-runtime/intl/loadmsgcat.c b/gettext-runtime/intl/loadmsgcat.c
index 2520c8c..8e01c53 100644
--- a/gettext-runtime/intl/loadmsgcat.c
+++ b/gettext-runtime/intl/loadmsgcat.c
@@ -1,5 +1,5 @@
/* Load needed message catalogs.
- Copyright (C) 1995-1999, 2000-2005 Free Software Foundation, Inc.
+ Copyright (C) 1995-1999, 2000-2006 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify it
under the terms of the GNU Library General Public License as published
@@ -976,6 +976,7 @@ _nl_load_domain (struct loaded_l10nfile *domain_file,
((char *) data
+ W (domain->must_swap, data->sysdep_segments_offset));
sysdep_segment_values =
+ (const char **)
alloca (n_sysdep_segments * sizeof (const char *));
for (i = 0; i < n_sysdep_segments; i++)
{
diff --git a/gettext-runtime/intl/localealias.c b/gettext-runtime/intl/localealias.c
index 26122a0..910db53 100644
--- a/gettext-runtime/intl/localealias.c
+++ b/gettext-runtime/intl/localealias.c
@@ -1,5 +1,5 @@
/* Handle aliases for locale names.
- Copyright (C) 1995-1999, 2000-2001, 2003, 2005 Free Software Foundation, Inc.
+ Copyright (C) 1995-1999, 2000-2001, 2003, 2005-2006 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify it
under the terms of the GNU Library General Public License as published
@@ -349,12 +349,14 @@ read_alias_file (const char *fname, int fname_len)
string_space_max = new_size;
}
- map[nmap].alias = memcpy (&string_space[string_space_act],
- alias, alias_len);
+ map[nmap].alias =
+ (const char *) memcpy (&string_space[string_space_act],
+ alias, alias_len);
string_space_act += alias_len;
- map[nmap].value = memcpy (&string_space[string_space_act],
- value, value_len);
+ map[nmap].value =
+ (const char *) memcpy (&string_space[string_space_act],
+ value, value_len);
string_space_act += value_len;
++nmap;
diff --git a/gettext-runtime/intl/plural-exp.c b/gettext-runtime/intl/plural-exp.c
index f518bf1..46fa758 100644
--- a/gettext-runtime/intl/plural-exp.c
+++ b/gettext-runtime/intl/plural-exp.c
@@ -1,5 +1,5 @@
/* Expression parsing for plural form selection.
- Copyright (C) 2000-2001, 2003, 2005 Free Software Foundation, Inc.
+ Copyright (C) 2000-2001, 2003, 2005-2006 Free Software Foundation, Inc.
Written by Ulrich Drepper <drepper@cygnus.com>, 2000.
This program is free software; you can redistribute it and/or modify it
@@ -27,7 +27,7 @@
#include "plural-exp.h"
-#if (defined __GNUC__ && !(__APPLE_CC__ > 1)) \
+#if (defined __GNUC__ && !(__APPLE_CC__ > 1) && !defined __cplusplus) \
|| (defined __STDC_VERSION__ && __STDC_VERSION__ >= 199901L)
/* These structs are the constant expression for the germanic plural
diff --git a/gettext-runtime/intl/plural-exp.h b/gettext-runtime/intl/plural-exp.h
index dc590d3..d062dd1 100644
--- a/gettext-runtime/intl/plural-exp.h
+++ b/gettext-runtime/intl/plural-exp.h
@@ -1,5 +1,5 @@
/* Expression parsing and evaluation for plural form selection.
- Copyright (C) 2000-2003, 2005 Free Software Foundation, Inc.
+ Copyright (C) 2000-2003, 2005-2006 Free Software Foundation, Inc.
Written by Ulrich Drepper <drepper@cygnus.com>, 2000.
This program is free software; you can redistribute it and/or modify it
@@ -29,35 +29,37 @@
#endif
+enum expression_operator
+{
+ /* Without arguments: */
+ var, /* The variable "n". */
+ num, /* Decimal number. */
+ /* Unary operators: */
+ lnot, /* Logical NOT. */
+ /* Binary operators: */
+ mult, /* Multiplication. */
+ divide, /* Division. */
+ module, /* Modulo operation. */
+ plus, /* Addition. */
+ minus, /* Subtraction. */
+ less_than, /* Comparison. */
+ greater_than, /* Comparison. */
+ less_or_equal, /* Comparison. */
+ greater_or_equal, /* Comparison. */
+ equal, /* Comparison for equality. */
+ not_equal, /* Comparison for inequality. */
+ land, /* Logical AND. */
+ lor, /* Logical OR. */
+ /* Ternary operators: */
+ qmop /* Question mark operator. */
+};
+
/* This is the representation of the expressions to determine the
plural form. */
struct expression
{
int nargs; /* Number of arguments. */
- enum operator
- {
- /* Without arguments: */
- var, /* The variable "n". */
- num, /* Decimal number. */
- /* Unary operators: */
- lnot, /* Logical NOT. */
- /* Binary operators: */
- mult, /* Multiplication. */
- divide, /* Division. */
- module, /* Modulo operation. */
- plus, /* Addition. */
- minus, /* Subtraction. */
- less_than, /* Comparison. */
- greater_than, /* Comparison. */
- less_or_equal, /* Comparison. */
- greater_or_equal, /* Comparison. */
- equal, /* Comparison for equality. */
- not_equal, /* Comparison for inequality. */
- land, /* Logical AND. */
- lor, /* Logical OR. */
- /* Ternary operators: */
- qmop /* Question mark operator. */
- } operation;
+ enum expression_operator operation;
union
{
unsigned long int num; /* Number value for `num'. */
diff --git a/gettext-runtime/intl/plural.y b/gettext-runtime/intl/plural.y
index 45d68e9..ec36a09 100644
--- a/gettext-runtime/intl/plural.y
+++ b/gettext-runtime/intl/plural.y
@@ -1,6 +1,6 @@
%{
/* Expression parsing for plural form selection.
- Copyright (C) 2000-2001, 2003, 2005 Free Software Foundation, Inc.
+ Copyright (C) 2000-2001, 2003, 2005-2006 Free Software Foundation, Inc.
Written by Ulrich Drepper <drepper@cygnus.com>, 2000.
This program is free software; you can redistribute it and/or modify it
@@ -50,7 +50,7 @@
%union {
unsigned long int num;
- enum operator op;
+ enum expression_operator op;
struct expression *exp;
}
@@ -62,7 +62,8 @@ static void yyerror (const char *str);
/* Allocation of expressions. */
static struct expression *
-new_exp (int nargs, enum operator op, struct expression * const *args)
+new_exp (int nargs, enum expression_operator op,
+ struct expression * const *args)
{
int i;
struct expression *newp;
@@ -91,13 +92,13 @@ new_exp (int nargs, enum operator op, struct expression * const *args)
}
static inline struct expression *
-new_exp_0 (enum operator op)
+new_exp_0 (enum expression_operator op)
{
return new_exp (0, op, NULL);
}
static inline struct expression *
-new_exp_1 (enum operator op, struct expression *right)
+new_exp_1 (enum expression_operator op, struct expression *right)
{
struct expression *args[1];
@@ -106,7 +107,8 @@ new_exp_1 (enum operator op, struct expression *right)
}
static struct expression *
-new_exp_2 (enum operator op, struct expression *left, struct expression *right)
+new_exp_2 (enum expression_operator op, struct expression *left,
+ struct expression *right)
{
struct expression *args[2];
@@ -116,7 +118,7 @@ new_exp_2 (enum operator op, struct expression *left, struct expression *right)
}
static inline struct expression *
-new_exp_3 (enum operator op, struct expression *bexp,
+new_exp_3 (enum expression_operator op, struct expression *bexp,
struct expression *tbranch, struct expression *fbranch)
{
struct expression *args[3];
diff --git a/gettext-tools/libgrep/ChangeLog b/gettext-tools/libgrep/ChangeLog
index 25b1513..c736ab7 100644
--- a/gettext-tools/libgrep/ChangeLog
+++ b/gettext-tools/libgrep/ChangeLog
@@ -1,3 +1,28 @@
+2006-10-29 Bruno Haible <bruno@clisp.org>
+
+ Make it compile in C++ mode.
+ * dfa.h (token): Typedef as int.
+ * dfa.c (remove): Renamed from delete.
+ (epsclosure): Update.
+ (match_mb_charset): Cast strncpy argument.
+ (dfaexec): Add cast.
+ (dfacomp): Cast malloc result.
+ (icatalloc): Rename argument names to 'stem', 'suffix'.
+ (enlist): Rename 'new' argument to 'suffix'.
+ (addlists): Rename 'new' argument to 'suffixes'.
+ (dfamust): Cast malloc results. Rename local variable 'new' to 'common'.
+ * kwset.c (kwsprep): Cast obstack_alloc result.
+ (bmexec): Cast memchr result.
+ * m-fgrep.c (Fexecute): Rename local variable 'try' to 'curr'. Cast
+ memchr result.
+ * m-regex.c (struct patterns): Move out of the scope of struct
+ compiled_regex.
+ (Gcompile, compile, EGexecute): Cast memchr results.
+ * regex.c (EXTEND_BUFFER): Cast REALLOC result.
+ (byte_re_match_2_internal): Limit the scope of same_str_p variable.
+ Rename local variable 'not' to 'invert'.
+ (regcomp): Cast malloc results.
+
2006-10-26 Bruno Haible <bruno@clisp.org>
* gettext-0.16 released.
diff --git a/gettext-tools/libgrep/dfa.c b/gettext-tools/libgrep/dfa.c
index f1046ad..443b8c7 100644
--- a/gettext-tools/libgrep/dfa.c
+++ b/gettext-tools/libgrep/dfa.c
@@ -1,5 +1,5 @@
/* dfa.c - deterministic extended regexp routines for GNU
- Copyright 1988, 1998, 2000, 2005 Free Software Foundation, Inc.
+ Copyright 1988, 1998, 2000, 2005-2006 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -1442,7 +1442,7 @@ merge (position_set const *s1, position_set const *s2, position_set *m)
/* Delete a position from a set. */
static void
-delete (position p, position_set *s)
+remove (position p, position_set *s)
{
int i;
@@ -1550,7 +1550,7 @@ epsclosure (position_set *s, struct dfa const *d)
{
old = s->elems[i];
p.constraint = old.constraint;
- delete(s->elems[i], s);
+ remove(s->elems[i], s);
if (visited[old.index])
{
--i;
@@ -2489,14 +2489,14 @@ match_mb_charset (struct dfa *d, int s, position pos, int index)
goto charset_matched;
}
- strncpy(buffer, buf_begin + index, match_len);
+ strncpy(buffer, (const char *) (buf_begin + index), match_len);
buffer[match_len] = '\0';
/* match with an equivalent class? */
for (i = 0; i<work_mbc->nequivs; i++)
{
op_len = strlen(work_mbc->equivs[i]);
- strncpy(buffer, buf_begin + index, op_len);
+ strncpy(buffer, (const char *) (buf_begin + index), op_len);
buffer[op_len] = '\0';
if (strcoll(work_mbc->equivs[i], buffer) == 0)
{
@@ -2509,7 +2509,7 @@ match_mb_charset (struct dfa *d, int s, position pos, int index)
for (i = 0; i<work_mbc->ncoll_elems; i++)
{
op_len = strlen(work_mbc->coll_elems[i]);
- strncpy(buffer, buf_begin + index, op_len);
+ strncpy(buffer, (const char *) (buf_begin + index), op_len);
buffer[op_len] = '\0';
if (strcoll(work_mbc->coll_elems[i], buffer) == 0)
@@ -2762,7 +2762,7 @@ dfaexec (struct dfa *d, char const *begin, size_t size, int *backref)
if (MB_CUR_MAX > 1)
{
int remain_bytes, i;
- buf_begin = begin;
+ buf_begin = (unsigned char const *)begin;
buf_end = end;
/* initialize mblen_buf, and inputwcs. */
@@ -2943,7 +2943,7 @@ dfacomp (char const *s, size_t len, struct dfa *d, int searchflag)
char *lcopy;
int i;
- lcopy = malloc(len);
+ lcopy = (char *) malloc(len);
if (!lcopy)
dfaerror(_("out of memory"));
@@ -3122,23 +3122,23 @@ dfafree (struct dfa *d)
'psi|epsilon' is likelier)? */
static char *
-icatalloc (char *old, char *new)
+icatalloc (char *stem, char *suffix)
{
char *result;
- size_t oldsize, newsize;
-
- newsize = (new == NULL) ? 0 : strlen(new);
- if (old == NULL)
- oldsize = 0;
- else if (newsize == 0)
- return old;
- else oldsize = strlen(old);
- if (old == NULL)
- result = (char *) malloc(newsize + 1);
+ size_t stemsize, suffixsize;
+
+ suffixsize = (suffix == NULL) ? 0 : strlen(suffix);
+ if (stem == NULL)
+ stemsize = 0;
+ else if (suffixsize == 0)
+ return stem;
+ else stemsize = strlen(stem);
+ if (stem == NULL)
+ result = (char *) malloc(suffixsize + 1);
else
- result = (char *) realloc((void *) old, oldsize + newsize + 1);
- if (result != NULL && new != NULL)
- (void) strcpy(result + oldsize, new);
+ result = (char *) realloc((void *) stem, stemsize + suffixsize + 1);
+ if (result != NULL && suffix != NULL)
+ (void) strcpy(result + stemsize, suffix);
return result;
}
@@ -3183,29 +3183,29 @@ freelist (char **cpp)
}
static char **
-enlist (char **cpp, char *new, size_t len)
+enlist (char **cpp, char *suffix, size_t len)
{
int i, j;
if (cpp == NULL)
return NULL;
- if ((new = icpyalloc(new)) == NULL)
+ if ((suffix = icpyalloc(suffix)) == NULL)
{
freelist(cpp);
return NULL;
}
- new[len] = '\0';
- /* Is there already something in the list that's new (or longer)? */
+ suffix[len] = '\0';
+ /* Is there already something in the list that's suffix (or longer)? */
for (i = 0; cpp[i] != NULL; ++i)
- if (istrstr(cpp[i], new) != NULL)
+ if (istrstr(cpp[i], suffix) != NULL)
{
- free(new);
+ free(suffix);
return cpp;
}
/* Eliminate any obsoleted strings. */
j = 0;
while (cpp[j] != NULL)
- if (istrstr(new, cpp[j]) == NULL)
+ if (istrstr(suffix, cpp[j]) == NULL)
++j;
else
{
@@ -3219,7 +3219,7 @@ enlist (char **cpp, char *new, size_t len)
cpp = (char **) realloc((char *) cpp, (i + 2) * sizeof *cpp);
if (cpp == NULL)
return NULL;
- cpp[i] = new;
+ cpp[i] = suffix;
cpp[i + 1] = NULL;
return cpp;
}
@@ -3262,15 +3262,15 @@ comsubs (char *left, char *right)
}
static char **
-addlists (char **old, char **new)
+addlists (char **old, char **suffixes)
{
int i;
- if (old == NULL || new == NULL)
+ if (old == NULL || suffixes == NULL)
return NULL;
- for (i = 0; new[i] != NULL; ++i)
+ for (i = 0; suffixes[i] != NULL; ++i)
{
- old = enlist(old, new[i], strlen(new[i]));
+ old = enlist(old, suffixes[i], strlen(suffixes[i]));
if (old == NULL)
break;
}
@@ -3352,9 +3352,9 @@ dfamust (struct dfa *dfa)
for (i = 0; i <= dfa->tindex; ++i)
{
mp[i].in = (char **) malloc(sizeof *mp[i].in);
- mp[i].left = malloc(2);
- mp[i].right = malloc(2);
- mp[i].is = malloc(2);
+ mp[i].left = (char *) malloc(2);
+ mp[i].right = (char *) malloc(2);
+ mp[i].is = (char *) malloc(2);
if (mp[i].in == NULL || mp[i].left == NULL ||
mp[i].right == NULL || mp[i].is == NULL)
goto done;
@@ -3399,7 +3399,7 @@ dfamust (struct dfa *dfa)
if (mp < &musts[2])
goto done; /* "cannot happen" */
{
- char **new;
+ char **common;
must *lmp;
must *rmp;
int j, ln, rn, n;
@@ -3426,12 +3426,12 @@ dfamust (struct dfa *dfa)
for (j = 0; j < i; ++j)
lmp->right[j] = lmp->right[(ln - i) + j];
lmp->right[j] = '\0';
- new = inboth(lmp->in, rmp->in);
- if (new == NULL)
+ common = inboth(lmp->in, rmp->in);
+ if (common == NULL)
goto done;
freelist(lmp->in);
free((char *) lmp->in);
- lmp->in = new;
+ lmp->in = common;
}
break;
case PLUS:
@@ -3556,7 +3556,7 @@ dfamust (struct dfa *dfa)
{
dm = (struct dfamust *) malloc(sizeof (struct dfamust));
dm->exact = exact;
- dm->must = malloc(strlen(result) + 1);
+ dm->must = (char *) malloc(strlen(result) + 1);
strcpy(dm->must, result);
dm->next = dfa->musts;
dfa->musts = dm;
diff --git a/gettext-tools/libgrep/dfa.h b/gettext-tools/libgrep/dfa.h
index 0b51a62..387ef98 100644
--- a/gettext-tools/libgrep/dfa.h
+++ b/gettext-tools/libgrep/dfa.h
@@ -1,5 +1,5 @@
/* dfa.h - declarations for GNU deterministic regexp compiler
- Copyright (C) 1988, 1998, 2005 Free Software Foundation, Inc.
+ Copyright (C) 1988, 1998, 2005-2006 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -49,7 +49,7 @@ typedef int charclass[CHARCLASS_INTS];
are operators and others are terminal symbols. Most (but not all) of these
codes are returned by the lexical analyzer. */
-typedef enum
+enum
{
END = -1, /* END is a terminal symbol that matches the
end of input; any value of END or less in
@@ -143,7 +143,8 @@ typedef enum
CSET /* CSET and (and any value greater) is a
terminal symbol that matches any of a
class of characters. */
-} token;
+};
+typedef int token;
/* Sets are stored in an array in the compiled dfa; the index of the
array corresponding to a given set token is given by SET_INDEX(t). */
diff --git a/gettext-tools/libgrep/kwset.c b/gettext-tools/libgrep/kwset.c
index 7e5f82c..00076e0 100644
--- a/gettext-tools/libgrep/kwset.c
+++ b/gettext-tools/libgrep/kwset.c
@@ -1,5 +1,5 @@
/* kwset.c - search for any of a set of keywords.
- Copyright 1989, 1998, 2000, 2005 Free Software Foundation, Inc.
+ Copyright 1989, 1998, 2000, 2005-2006 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -400,7 +400,7 @@ kwsprep (kwset_t kws)
if (kwset->words == 1 && kwset->trans == 0)
{
/* Looking for just one string. Extract it from the trie. */
- kwset->target = obstack_alloc(&kwset->obstack, kwset->mind);
+ kwset->target = (char *) obstack_alloc(&kwset->obstack, kwset->mind);
for (i = kwset->mind - 1, curr = kwset->trie; i >= 0; --i)
{
kwset->target[i] = curr->links->label;
@@ -508,7 +508,7 @@ bmexec (kwset_t kws, char const *text, size_t size)
return -1;
if (len == 1)
{
- tp = memchr (text, kwset->target[0], size);
+ tp = (const char *) memchr (text, kwset->target[0], size);
return tp ? tp - text : -1;
}
diff --git a/gettext-tools/libgrep/m-fgrep.c b/gettext-tools/libgrep/m-fgrep.c
index 28f900c..305b997 100644
--- a/gettext-tools/libgrep/m-fgrep.c
+++ b/gettext-tools/libgrep/m-fgrep.c
@@ -1,5 +1,5 @@
/* Pattern Matcher for Fixed String search.
- Copyright (C) 1992, 1998, 2000, 2005 Free Software Foundation, Inc.
+ Copyright (C) 1992, 1998, 2000, 2005-2006 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -72,7 +72,7 @@ Fexecute (const void *compiled_pattern, const char *buf, size_t buf_size,
size_t *match_size, bool exact)
{
struct compiled_kwset *ckwset = (struct compiled_kwset *) compiled_pattern;
- register const char *beg, *try, *end;
+ register const char *beg, *curr, *end;
register size_t len;
char eol = ckwset->eolbyte;
struct kwsmatch kwsmatch;
@@ -118,12 +118,12 @@ Fexecute (const void *compiled_pattern, const char *buf, size_t buf_size,
goto success;
}
else if (ckwset->match_words)
- for (try = beg; len; )
+ for (curr = beg; len; )
{
- if (try > buf && IS_WORD_CONSTITUENT ((unsigned char) try[-1]))
+ if (curr > buf && IS_WORD_CONSTITUENT ((unsigned char) curr[-1]))
break;
- if (try + len < buf + buf_size
- && IS_WORD_CONSTITUENT ((unsigned char) try[len]))
+ if (curr + len < buf + buf_size
+ && IS_WORD_CONSTITUENT ((unsigned char) curr[len]))
{
offset = kwsexec (ckwset->kwset, beg, --len, &kwsmatch);
if (offset == (size_t) -1)
@@ -134,7 +134,7 @@ Fexecute (const void *compiled_pattern, const char *buf, size_t buf_size,
#endif /* MBS_SUPPORT */
return offset;
}
- try = beg + offset;
+ curr = beg + offset;
len = kwsmatch.size[0];
}
else
@@ -151,7 +151,7 @@ Fexecute (const void *compiled_pattern, const char *buf, size_t buf_size,
return -1;
success:
- end = memchr (beg + len, eol, (buf + buf_size) - (beg + len));
+ end = (const char *) memchr (beg + len, eol, (buf + buf_size) - (beg + len));
end++;
while (buf < beg && beg[-1] != eol)
--beg;
diff --git a/gettext-tools/libgrep/m-regex.c b/gettext-tools/libgrep/m-regex.c
index 6f7aae3..a53c96f 100644
--- a/gettext-tools/libgrep/m-regex.c
+++ b/gettext-tools/libgrep/m-regex.c
@@ -1,5 +1,5 @@
/* Pattern Matchers for Regular Expressions.
- Copyright (C) 1992, 1998, 2000, 2005 Free Software Foundation, Inc.
+ Copyright (C) 1992, 1998, 2000, 2005-2006 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -41,6 +41,14 @@
#endif
#define ISALNUM(C) (IN_CTYPE_DOMAIN (C) && isalnum (C))
+struct patterns
+{
+ /* Regex compiled regexp. */
+ struct re_pattern_buffer regexbuf;
+ struct re_registers regs; /* This is here on account of a BRAIN-DEAD
+ Q@#%!# library interface in regex.c. */
+};
+
struct compiled_regex {
bool match_words;
bool match_lines;
@@ -50,13 +58,7 @@ struct compiled_regex {
struct dfa dfa;
/* The Regex compiled patterns. */
- struct patterns
- {
- /* Regex compiled regexp. */
- struct re_pattern_buffer regexbuf;
- struct re_registers regs; /* This is here on account of a BRAIN-DEAD
- Q@#%!# library interface in regex.c. */
- } *patterns;
+ struct patterns *patterns;
size_t pcount;
/* KWset compiled pattern. We compile a list of strings, at least one of
@@ -143,7 +145,7 @@ Gcompile (const char *pattern, size_t pattern_size,
do
{
size_t len;
- sep = memchr (motif, '\n', total);
+ sep = (const char *) memchr (motif, '\n', total);
if (sep)
{
len = sep - motif;
@@ -229,7 +231,7 @@ compile (const char *pattern, size_t pattern_size,
do
{
size_t len;
- sep = memchr (motif, '\n', total);
+ sep = (const char *) memchr (motif, '\n', total);
if (sep)
{
len = sep - motif;
@@ -345,7 +347,7 @@ EGexecute (const void *compiled_pattern,
beg += offset;
/* Narrow down to the line containing the candidate, and
run it through DFA. */
- end = memchr (beg, eol, buflim - beg);
+ end = (const char *) memchr (beg, eol, buflim - beg);
if (end != NULL)
end++;
else
@@ -369,7 +371,7 @@ EGexecute (const void *compiled_pattern,
break;
/* Narrow down to the line we've found. */
beg += offset;
- end = memchr (beg, eol, buflim - beg);
+ end = (const char *) memchr (beg, eol, buflim - beg);
if (end != NULL)
end++;
else
diff --git a/gettext-tools/libgrep/regex.c b/gettext-tools/libgrep/regex.c
index aec323a..de19ca3 100644
--- a/gettext-tools/libgrep/regex.c
+++ b/gettext-tools/libgrep/regex.c
@@ -2080,7 +2080,7 @@ static reg_errcode_t byte_compile_range (unsigned int range_start,
bufp->allocated <<= 1; \
if (bufp->allocated > MAX_BUF_SIZE) \
bufp->allocated = MAX_BUF_SIZE; \
- bufp->buffer = REALLOC (COMPILED_BUFFER_VAR, bufp->allocated); \
+ bufp->buffer = (UCHAR_T *) REALLOC (COMPILED_BUFFER_VAR, bufp->allocated); \
if (COMPILED_BUFFER_VAR == NULL) \
return REG_ESPACE; \
/* If the buffer moved, move all the pointers into it. */ \
@@ -6011,19 +6011,21 @@ byte_re_match_2_internal (struct re_pattern_buffer *bufp,
longest match, try backtracking. */
if (d != end_match_2)
{
- /* 1 if this match ends in the same string (string1 or string2)
- as the best previous match. */
- boolean same_str_p = (FIRST_STRING_P (match_end)
- == MATCHING_IN_FIRST_STRING);
/* 1 if this match is the best seen so far. */
boolean best_match_p;
-
- /* AIX compiler got confused when this was combined
- with the previous declaration. */
- if (same_str_p)
- best_match_p = d > match_end;
- else
- best_match_p = !MATCHING_IN_FIRST_STRING;
+ {
+ /* 1 if this match ends in the same string (string1 or string2)
+ as the best previous match. */
+ boolean same_str_p = (FIRST_STRING_P (match_end)
+ == MATCHING_IN_FIRST_STRING);
+
+ /* AIX compiler got confused when this was combined
+ with the previous declaration. */
+ if (same_str_p)
+ best_match_p = d > match_end;
+ else
+ best_match_p = !MATCHING_IN_FIRST_STRING;
+ }
DEBUG_PRINT1 ("backtracking.\n");
@@ -6278,9 +6280,9 @@ byte_re_match_2_internal (struct re_pattern_buffer *bufp,
uint32_t nrules;
# endif /* _LIBC */
#endif /* WCHAR */
- boolean not = (re_opcode_t) *(p - 1) == charset_not;
+ boolean invert = (re_opcode_t) *(p - 1) == charset_not;
- DEBUG_PRINT2 ("EXECUTING charset%s.\n", not ? "_not" : "");
+ DEBUG_PRINT2 ("EXECUTING charset%s.\n", invert ? "_not" : "");
PREFETCH ();
c = TRANSLATE (*d); /* The character to match. */
#ifdef WCHAR
@@ -6613,20 +6615,20 @@ byte_re_match_2_internal (struct re_pattern_buffer *bufp,
if (c == *workp)
goto char_set_matched;
- not = !not;
+ invert = !invert;
char_set_matched:
- if (not) goto fail;
+ if (invert) goto fail;
#else
/* Cast to `unsigned' instead of `unsigned char' in case the
bit list is a full 32 bytes long. */
if (c < (unsigned) (*p * BYTEWIDTH)
&& p[1 + c / BYTEWIDTH] & (1 << (c % BYTEWIDTH)))
- not = !not;
+ invert = !invert;
p += 1 + *p;
- if (!not) goto fail;
+ if (!invert) goto fail;
#undef WORK_BUFFER_SIZE
#endif /* WCHAR */
SET_REGS_MATCHED ();
@@ -7126,15 +7128,15 @@ byte_re_match_2_internal (struct re_pattern_buffer *bufp,
else if ((re_opcode_t) p1[3] == charset
|| (re_opcode_t) p1[3] == charset_not)
{
- int not = (re_opcode_t) p1[3] == charset_not;
+ int invert = (re_opcode_t) p1[3] == charset_not;
if (c < (unsigned) (p1[4] * BYTEWIDTH)
&& p1[5 + c / BYTEWIDTH] & (1 << (c % BYTEWIDTH)))
- not = !not;
+ invert = !invert;
/* `not' is equal to 1 if c would match, which means
that we can't change to pop_failure_jump. */
- if (!not)
+ if (!invert)
{
p[-3] = (unsigned char) pop_failure_jump;
DEBUG_PRINT1 (" No match => pop_failure_jump.\n");
@@ -8015,14 +8017,15 @@ regcomp (regex_t *preg, const char *pattern, int cflags)
preg->used = 0;
/* Try to allocate space for the fastmap. */
- preg->fastmap = malloc (1 << BYTEWIDTH);
+ preg->fastmap = (char *) malloc (1 << BYTEWIDTH);
if (cflags & REG_ICASE)
{
unsigned i;
- preg->translate = malloc (CHAR_SET_SIZE
- * sizeof (*(RE_TRANSLATE_TYPE)0));
+ preg->translate =
+ (RE_TRANSLATE_TYPE)
+ malloc (CHAR_SET_SIZE * sizeof (*(RE_TRANSLATE_TYPE)0));
if (preg->translate == NULL)
return (int) REG_ESPACE;
diff --git a/gettext-tools/src/ChangeLog b/gettext-tools/src/ChangeLog
index 3ddacf6..463c7a2 100644
--- a/gettext-tools/src/ChangeLog
+++ b/gettext-tools/src/ChangeLog
@@ -1,5 +1,33 @@
2006-10-29 Bruno Haible <bruno@clisp.org>
+ Make it compile in C++ mode.
+ * dir-list.c (dir_list_restore): Add cast.
+ * format-c.c (format_arg_type_t): New type. Use it instead of
+ 'enum format_arg_type'.
+ * format-gcc-internal.c (format_arg_type_t): New type. Use it instead of
+ 'enum format_arg_type'.
+ * format-perl.c (format_arg_type_t): New type. Use it instead of
+ 'enum format_arg_type'.
+ * format-lisp.c (struct segment): Move out of the scope of struct
+ format_arg_list.
+ * format-scheme.c (struct segment): Likewise.
+ * message.h (struct altstr): Move out of the scope of struct message_ty.
+ * msgl-equal.c (msgstr_equal_ignoring_potcdate): Cast memchr results.
+ * po-lex.c (mb_copy): Rename arguments to new_mbc, old_mbc.
+ * read-mo.c (enum mo_endianness): Move out of the scope of struct
+ binary_mo_file.
+ * read-po.c (this): New macro.
+ * read-properties.c (this): New macro.
+ * write-mo.c (write_table): Cast alloca result.
+ * x-glade.c (load_libexpat): Cast dlsym results.
+ * x-perl.c (get_here_document): Use xmalloc instead of
+ xrealloc (NULL...). Cast its result.
+ * x-po.c (extract_add_message): Limit the scope of variable
+ 'charsetstr'.
+ * x-smalltalk.c (phase2_get): Cast xmalloc results.
+
+2006-10-29 Bruno Haible <bruno@clisp.org>
+
* x-awk.h: Make includable without prerequisites.
* x-c.h: Likewise.
* x-csharp.h: Likewise.
diff --git a/gettext-tools/src/dir-list.c b/gettext-tools/src/dir-list.c
index e0ca78e..cf9d158 100644
--- a/gettext-tools/src/dir-list.c
+++ b/gettext-tools/src/dir-list.c
@@ -1,5 +1,5 @@
/* GNU gettext - internationalization aids
- Copyright (C) 1996, 1998, 2000-2002 Free Software Foundation, Inc.
+ Copyright (C) 1996, 1998, 2000-2002, 2006 Free Software Foundation, Inc.
This file was written by Peter Miller <millerp@canb.auug.org.au>
@@ -82,5 +82,5 @@ dir_list_restore (void *saved_value)
free (directory);
}
- directory = saved_value;
+ directory = (string_list_ty *) saved_value;
}
diff --git a/gettext-tools/src/format-c.c b/gettext-tools/src/format-c.c
index 31d27bc..df34701 100644
--- a/gettext-tools/src/format-c.c
+++ b/gettext-tools/src/format-c.c
@@ -134,16 +134,21 @@ enum format_arg_type
| FAT_SIZE_INTMAX_T | FAT_SIZE_INTPTR_T
| FAT_SIZE_SIZE_T | FAT_SIZE_PTRDIFF_T)
};
+#ifdef __cplusplus
+typedef int format_arg_type_t;
+#else
+typedef enum format_arg_type format_arg_type_t;
+#endif
struct numbered_arg
{
unsigned int number;
- enum format_arg_type type;
+ format_arg_type_t type;
};
struct unnumbered_arg
{
- enum format_arg_type type;
+ format_arg_type_t type;
};
struct spec
@@ -200,8 +205,8 @@ format_parse (const char *format, bool translated, bool objc_extensions,
{
/* A directive. */
unsigned int number = 0;
- enum format_arg_type type;
- enum format_arg_type size;
+ format_arg_type_t type;
+ format_arg_type_t size;
spec.directives++;
@@ -733,9 +738,9 @@ format_parse (const char *format, bool translated, bool objc_extensions,
for (i = j = 0; i < numbered_arg_count; i++)
if (j > 0 && numbered[i].number == numbered[j-1].number)
{
- enum format_arg_type type1 = numbered[i].type;
- enum format_arg_type type2 = numbered[j-1].type;
- enum format_arg_type type_both;
+ format_arg_type_t type1 = numbered[i].type;
+ format_arg_type_t type2 = numbered[j-1].type;
+ format_arg_type_t type_both;
if (type1 == type2)
type_both = type1;
diff --git a/gettext-tools/src/format-gcc-internal.c b/gettext-tools/src/format-gcc-internal.c
index a0137e9..d2a006b 100644
--- a/gettext-tools/src/format-gcc-internal.c
+++ b/gettext-tools/src/format-gcc-internal.c
@@ -119,11 +119,16 @@ enum format_arg_type
/* Bitmasks */
FAT_SIZE_MASK = (FAT_SIZE_LONG | FAT_SIZE_LONGLONG | FAT_SIZE_WIDE)
};
+#ifdef __cplusplus
+typedef int format_arg_type_t;
+#else
+typedef enum format_arg_type format_arg_type_t;
+#endif
struct numbered_arg
{
unsigned int number;
- enum format_arg_type type;
+ format_arg_type_t type;
};
struct spec
@@ -184,8 +189,8 @@ format_parse (const char *format, bool translated, char **invalid_reason)
unsigned int flag_w = 0;
unsigned int flag_plus = 0;
unsigned int flag_sharp = 0;
- enum format_arg_type size;
- enum format_arg_type type;
+ format_arg_type_t size;
+ format_arg_type_t type;
if (isdigit (*format))
{
@@ -490,9 +495,9 @@ format_parse (const char *format, bool translated, char **invalid_reason)
for (i = j = 0; i < spec.numbered_arg_count; i++)
if (j > 0 && spec.numbered[i].number == spec.numbered[j-1].number)
{
- enum format_arg_type type1 = spec.numbered[i].type;
- enum format_arg_type type2 = spec.numbered[j-1].type;
- enum format_arg_type type_both;
+ format_arg_type_t type1 = spec.numbered[i].type;
+ format_arg_type_t type2 = spec.numbered[j-1].type;
+ format_arg_type_t type_both;
if (type1 == type2)
type_both = type1;
diff --git a/gettext-tools/src/format-lisp.c b/gettext-tools/src/format-lisp.c
index c431439..b9b6ad7 100644
--- a/gettext-tools/src/format-lisp.c
+++ b/gettext-tools/src/format-lisp.c
@@ -78,6 +78,15 @@ struct format_arg
struct format_arg_list *list; /* For FAT_LIST: List elements. */
};
+struct segment
+{
+ unsigned int count; /* Number of format_arg records used. */
+ unsigned int allocated;
+ struct format_arg *element; /* Argument constraints. */
+ unsigned int length; /* Number of arguments represented by this segment.
+ This is the sum of all repcounts in the segment. */
+};
+
struct format_arg_list
{
/* The constraints for the potentially infinite argument list are assumed
@@ -90,16 +99,8 @@ struct format_arg_list
A finite sequence is represented entirely in the initial segment; the
loop segment is empty. */
- struct segment
- {
- unsigned int count; /* Number of format_arg records used. */
- unsigned int allocated;
- struct format_arg *element; /* Argument constraints. */
- unsigned int length; /* Number of arguments represented by this segment.
- This is the sum of all repcounts in the segment. */
- }
- initial, /* Initial arguments segment. */
- repeated; /* Endlessly repeated segment. */
+ struct segment initial; /* Initial arguments segment. */
+ struct segment repeated; /* Endlessly repeated segment. */
};
struct spec
diff --git a/gettext-tools/src/format-perl.c b/gettext-tools/src/format-perl.c
index 7539810..f20c49d 100644
--- a/gettext-tools/src/format-perl.c
+++ b/gettext-tools/src/format-perl.c
@@ -94,11 +94,16 @@ enum format_arg_type
FAT_SIZE_MASK = (FAT_SIZE_SHORT | FAT_SIZE_V | FAT_SIZE_PTR
| FAT_SIZE_LONG | FAT_SIZE_LONGLONG)
};
+#ifdef __cplusplus
+typedef int format_arg_type_t;
+#else
+typedef enum format_arg_type format_arg_type_t;
+#endif
struct numbered_arg
{
unsigned int number;
- enum format_arg_type type;
+ format_arg_type_t type;
};
struct spec
@@ -150,8 +155,8 @@ format_parse (const char *format, bool translated, char **invalid_reason)
/* A directive. */
unsigned int number = 0;
bool vectorize = false;
- enum format_arg_type type;
- enum format_arg_type size;
+ format_arg_type_t type;
+ format_arg_type_t size;
directives++;
@@ -472,9 +477,9 @@ format_parse (const char *format, bool translated, char **invalid_reason)
for (i = j = 0; i < numbered_arg_count; i++)
if (j > 0 && numbered[i].number == numbered[j-1].number)
{
- enum format_arg_type type1 = numbered[i].type;
- enum format_arg_type type2 = numbered[j-1].type;
- enum format_arg_type type_both;
+ format_arg_type_t type1 = numbered[i].type;
+ format_arg_type_t type2 = numbered[j-1].type;
+ format_arg_type_t type_both;
if (type1 == type2)
type_both = type1;
diff --git a/gettext-tools/src/format-scheme.c b/gettext-tools/src/format-scheme.c
index 5005b02..b4300c4 100644
--- a/gettext-tools/src/format-scheme.c
+++ b/gettext-tools/src/format-scheme.c
@@ -81,6 +81,15 @@ struct format_arg
struct format_arg_list *list; /* For FAT_LIST: List elements. */
};
+struct segment
+{
+ unsigned int count; /* Number of format_arg records used. */
+ unsigned int allocated;
+ struct format_arg *element; /* Argument constraints. */
+ unsigned int length; /* Number of arguments represented by this segment.
+ This is the sum of all repcounts in the segment. */
+};
+
struct format_arg_list
{
/* The constraints for the potentially infinite argument list are assumed
@@ -93,16 +102,8 @@ struct format_arg_list
A finite sequence is represented entirely in the initial segment; the
loop segment is empty. */
- struct segment
- {
- unsigned int count; /* Number of format_arg records used. */
- unsigned int allocated;
- struct format_arg *element; /* Argument constraints. */
- unsigned int length; /* Number of arguments represented by this segment.
- This is the sum of all repcounts in the segment. */
- }
- initial, /* Initial arguments segment. */
- repeated; /* Endlessly repeated segment. */
+ struct segment initial; /* Initial arguments segment. */
+ struct segment repeated; /* Endlessly repeated segment. */
};
struct spec
diff --git a/gettext-tools/src/message.h b/gettext-tools/src/message.h
index 1e04049..dc7a234 100644
--- a/gettext-tools/src/message.h
+++ b/gettext-tools/src/message.h
@@ -98,6 +98,17 @@ enum is_wrap
#endif
+struct altstr
+{
+ const char *msgstr;
+ size_t msgstr_len;
+ const char *msgstr_end;
+ string_list_ty *comment;
+ string_list_ty *comment_dot;
+ char *id;
+};
+
+
typedef struct message_ty message_ty;
struct message_ty
{
@@ -156,16 +167,7 @@ struct message_ty
/* Used for combining alternative translations, in the msgcat program. */
int alternative_count;
- struct altstr
- {
- const char *msgstr;
- size_t msgstr_len;
- const char *msgstr_end;
- string_list_ty *comment;
- string_list_ty *comment_dot;
- char *id;
- }
- *alternative;
+ struct altstr *alternative;
};
extern message_ty *
diff --git a/gettext-tools/src/msgl-equal.c b/gettext-tools/src/msgl-equal.c
index 3485709..209ee16 100644
--- a/gettext-tools/src/msgl-equal.c
+++ b/gettext-tools/src/msgl-equal.c
@@ -57,7 +57,7 @@ msgstr_equal_ignoring_potcdate (const char *msgstr1, size_t msgstr1_len,
}
if (memcmp (ptr1, field, fieldlen) == 0)
break;
- ptr1 = memchr (ptr1, '\n', msgstr1_end - ptr1);
+ ptr1 = (const char *) memchr (ptr1, '\n', msgstr1_end - ptr1);
if (ptr1 == NULL)
break;
ptr1++;
@@ -73,7 +73,7 @@ msgstr_equal_ignoring_potcdate (const char *msgstr1, size_t msgstr1_len,
}
if (memcmp (ptr2, field, fieldlen) == 0)
break;
- ptr2 = memchr (ptr2, '\n', msgstr2_end - ptr2);
+ ptr2 = (const char *) memchr (ptr2, '\n', msgstr2_end - ptr2);
if (ptr2 == NULL)
break;
ptr2++;
@@ -91,11 +91,11 @@ msgstr_equal_ignoring_potcdate (const char *msgstr1, size_t msgstr1_len,
/* Compare, ignoring the lines starting at ptr1 and ptr2. */
if (msgstr_equal (msgstr1, ptr1 - msgstr1, msgstr2, ptr2 - msgstr2))
{
- ptr1 = memchr (ptr1, '\n', msgstr1_end - ptr1);
+ ptr1 = (const char *) memchr (ptr1, '\n', msgstr1_end - ptr1);
if (ptr1 == NULL)
ptr1 = msgstr1_end;
- ptr2 = memchr (ptr2, '\n', msgstr2_end - ptr2);
+ ptr2 = (const char *) memchr (ptr2, '\n', msgstr2_end - ptr2);
if (ptr2 == NULL)
ptr2 = msgstr2_end;
diff --git a/gettext-tools/src/po-lex.c b/gettext-tools/src/po-lex.c
index e806e9e..57acaaf 100644
--- a/gettext-tools/src/po-lex.c
+++ b/gettext-tools/src/po-lex.c
@@ -326,13 +326,13 @@ mb_setascii (mbchar_t mbc, char sc)
/* Copying a character. */
static inline void
-mb_copy (mbchar_t new, const mbchar_t old)
+mb_copy (mbchar_t new_mbc, const mbchar_t old_mbc)
{
- memcpy_small (&new->buf[0], &old->buf[0], old->bytes);
- new->bytes = old->bytes;
+ memcpy_small (&new_mbc->buf[0], &old_mbc->buf[0], old_mbc->bytes);
+ new_mbc->bytes = old_mbc->bytes;
#if HAVE_ICONV
- if ((new->uc_valid = old->uc_valid))
- new->uc = old->uc;
+ if ((new_mbc->uc_valid = old_mbc->uc_valid))
+ new_mbc->uc = old_mbc->uc;
#endif
}
diff --git a/gettext-tools/src/read-mo.c b/gettext-tools/src/read-mo.c
index a7524c4..c6bc9d0 100644
--- a/gettext-tools/src/read-mo.c
+++ b/gettext-tools/src/read-mo.c
@@ -44,6 +44,12 @@
#define _(str) gettext (str)
+enum mo_endianness
+{
+ MO_LITTLE_ENDIAN,
+ MO_BIG_ENDIAN
+};
+
/* We read the file completely into memory. This is more efficient than
lots of lseek(). This struct represents the .mo file in memory. */
struct binary_mo_file
@@ -51,7 +57,7 @@ struct binary_mo_file
const char *filename;
char *data;
size_t size;
- enum { MO_LITTLE_ENDIAN, MO_BIG_ENDIAN } endian;
+ enum mo_endianness endian;
};
diff --git a/gettext-tools/src/read-po.c b/gettext-tools/src/read-po.c
index 61a73a2..8cdfa0b 100644
--- a/gettext-tools/src/read-po.c
+++ b/gettext-tools/src/read-po.c
@@ -25,6 +25,12 @@
#include "po-lex.h"
#include "po-gram.h"
+/* For compiling this file in C++ mode. */
+#ifdef __cplusplus
+# define this thiss
+#endif
+
+
/* Read a .po / .pot file from a stream, and dispatch to the various
abstract_catalog_reader_class_ty methods. */
static void
diff --git a/gettext-tools/src/read-properties.c b/gettext-tools/src/read-properties.c
index fc20c1e..19fa539 100644
--- a/gettext-tools/src/read-properties.c
+++ b/gettext-tools/src/read-properties.c
@@ -44,6 +44,12 @@
#define _(str) gettext (str)
+/* For compiling this file in C++ mode. */
+#ifdef __cplusplus
+# define this thiss
+#endif
+
+
/* The format of the Java .properties files is documented in the JDK
documentation for class java.util.Properties. In the case of .properties
files for PropertyResourceBundle, each non-comment line contains a
diff --git a/gettext-tools/src/write-mo.c b/gettext-tools/src/write-mo.c
index 8c4cf1c..2ef6810 100644
--- a/gettext-tools/src/write-mo.c
+++ b/gettext-tools/src/write-mo.c
@@ -1,5 +1,5 @@
/* Writing binary .mo files.
- Copyright (C) 1995-1998, 2000-2005 Free Software Foundation, Inc.
+ Copyright (C) 1995-1998, 2000-2006 Free Software Foundation, Inc.
Written by Ulrich Drepper <drepper@gnu.ai.mit.edu>, April 1995.
This program is free software; you can redistribute it and/or modify
@@ -706,7 +706,7 @@ write_table (FILE *output_file, message_list_ty *mlp)
offset = end_offset;
/* A few zero bytes for padding. */
- null = alloca (alignment);
+ null = (char *) alloca (alignment);
memset (null, '\0', alignment);
/* Now write the original strings. */
diff --git a/gettext-tools/src/x-glade.c b/gettext-tools/src/x-glade.c
index 76ef510..bcb259e 100644
--- a/gettext-tools/src/x-glade.c
+++ b/gettext-tools/src/x-glade.c
@@ -166,16 +166,44 @@ load_libexpat ()
handle = dlopen ("libexpat.so.0", RTLD_LAZY);
#endif
if (handle != NULL
- && (p_XML_ParserCreate = dlsym (handle, "XML_ParserCreate")) != NULL
- && (p_XML_SetElementHandler = dlsym (handle, "XML_SetElementHandler")) != NULL
- && (p_XML_SetCharacterDataHandler = dlsym (handle, "XML_SetCharacterDataHandler")) != NULL
- && (p_XML_SetCommentHandler = dlsym (handle, "XML_SetCommentHandler")) != NULL
- && (p_XML_Parse = dlsym (handle, "XML_Parse")) != NULL
- && (p_XML_GetErrorCode = dlsym (handle, "XML_GetErrorCode")) != NULL
- && (p_XML_GetCurrentLineNumber = dlsym (handle, "XML_GetCurrentLineNumber")) != NULL
- && (p_XML_GetCurrentColumnNumber = dlsym (handle, "XML_GetCurrentColumnNumber")) != NULL
- && (p_XML_ParserFree = dlsym (handle, "XML_ParserFree")) != NULL
- && (p_XML_ErrorString = dlsym (handle, "XML_ErrorString")) != NULL)
+ && (p_XML_ParserCreate =
+ (XML_Parser (*) (const XML_Char *))
+ dlsym (handle, "XML_ParserCreate")) != NULL
+ && (p_XML_SetElementHandler =
+ (void (*) (XML_Parser, XML_StartElementHandler, XML_EndElementHandler))
+ dlsym (handle, "XML_SetElementHandler")) != NULL
+ && (p_XML_SetCharacterDataHandler =
+ (void (*) (XML_Parser, XML_CharacterDataHandler))
+ dlsym (handle, "XML_SetCharacterDataHandler")) != NULL
+ && (p_XML_SetCommentHandler =
+ (void (*) (XML_Parser, XML_CommentHandler))
+ dlsym (handle, "XML_SetCommentHandler")) != NULL
+ && (p_XML_Parse =
+ (int (*) (XML_Parser, const char *, int, int))
+ dlsym (handle, "XML_Parse")) != NULL
+ && (p_XML_GetErrorCode =
+ (enum XML_Error (*) (XML_Parser))
+ dlsym (handle, "XML_GetErrorCode")) != NULL
+ && (p_XML_GetCurrentLineNumber =
+#if XML_MAJOR_VERSION >= 2
+ (XML_Size (*) (XML_Parser))
+#else
+ (int (*) (XML_Parser))
+#endif
+ dlsym (handle, "XML_GetCurrentLineNumber")) != NULL
+ && (p_XML_GetCurrentColumnNumber =
+#if XML_MAJOR_VERSION >= 2
+ (XML_Size (*) (XML_Parser))
+#else
+ (int (*) (XML_Parser))
+#endif
+ dlsym (handle, "XML_GetCurrentColumnNumber")) != NULL
+ && (p_XML_ParserFree =
+ (void (*) (XML_Parser))
+ dlsym (handle, "XML_ParserFree")) != NULL
+ && (p_XML_ErrorString =
+ (const XML_LChar * (*) (int))
+ dlsym (handle, "XML_ErrorString")) != NULL)
libexpat_loaded = 1;
else
libexpat_loaded = -1;
diff --git a/gettext-tools/src/x-perl.c b/gettext-tools/src/x-perl.c
index 4cb058b..4886926 100644
--- a/gettext-tools/src/x-perl.c
+++ b/gettext-tools/src/x-perl.c
@@ -286,7 +286,7 @@ get_here_document (const char *delimiter)
/* Allocate the initial buffer. Later on, bufmax > 0. */
if (bufmax == 0)
{
- buffer = xrealloc (NULL, 1);
+ buffer = (char *) xmalloc (1);
buffer[0] = '\0';
bufmax = 1;
}
diff --git a/gettext-tools/src/x-po.c b/gettext-tools/src/x-po.c
index 7f980a9..5142802 100644
--- a/gettext-tools/src/x-po.c
+++ b/gettext-tools/src/x-po.c
@@ -76,23 +76,25 @@ extract_add_message (default_catalog_reader_ty *this,
because the old header may contain a charset= directive. */
if (msgctxt == NULL && *msgid == '\0' && !xgettext_omit_header)
{
- const char *charsetstr = strstr (msgstr, "charset=");
-
- if (charsetstr != NULL)
- {
- size_t len;
- char *charset;
-
- charsetstr += strlen ("charset=");
- len = strcspn (charsetstr, " \t\n");
- charset = (char *) xmalloc (len + 1);
- memcpy (charset, charsetstr, len);
- charset[len] = '\0';
-
- if (header_charset != NULL)
- free (header_charset);
- header_charset = charset;
- }
+ {
+ const char *charsetstr = strstr (msgstr, "charset=");
+
+ if (charsetstr != NULL)
+ {
+ size_t len;
+ char *charset;
+
+ charsetstr += strlen ("charset=");
+ len = strcspn (charsetstr, " \t\n");
+ charset = (char *) xmalloc (len + 1);
+ memcpy (charset, charsetstr, len);
+ charset[len] = '\0';
+
+ if (header_charset != NULL)
+ free (header_charset);
+ header_charset = charset;
+ }
+ }
discard:
if (msgctxt != NULL)
diff --git a/gettext-tools/src/x-smalltalk.c b/gettext-tools/src/x-smalltalk.c
index 0f759d2..371baab 100644
--- a/gettext-tools/src/x-smalltalk.c
+++ b/gettext-tools/src/x-smalltalk.c
@@ -326,7 +326,7 @@ phase2_get (token_ty *tp)
case '@':
case '?':
case '%':
- name = xmalloc (3);
+ name = (char *) xmalloc (3);
name[0] = c;
name[1] = c2;
name[2] = '\0';
@@ -337,7 +337,7 @@ phase2_get (token_ty *tp)
phase1_ungetc (c2);
break;
}
- name = xmalloc (2);
+ name = (char *) xmalloc (2);
name[0] = c;
name[1] = '\0';
tp->type = token_type_symbol;
diff --git a/gnulib-local/ChangeLog b/gnulib-local/ChangeLog
index 20c3d7e..1ddfb6b 100644
--- a/gnulib-local/ChangeLog
+++ b/gnulib-local/ChangeLog
@@ -1,3 +1,11 @@
+2006-10-29 Bruno Haible <bruno@clisp.org>
+
+ Make it compile in C++ mode.
+ * lib/backupfile.c (find_backup_file_name): Cast malloc result.
+ * lib/xalloc.h (xrealloc): Define as template with appropriate return
+ type.
+ * lib/xstrdup.c (xstrdup): Cast xmalloc result.
+
2006-10-26 Bruno Haible <bruno@clisp.org>
* gettext-0.16 released.
diff --git a/gnulib-local/lib/backupfile.c b/gnulib-local/lib/backupfile.c
index 25ee119..d1b962d 100644
--- a/gnulib-local/lib/backupfile.c
+++ b/gnulib-local/lib/backupfile.c
@@ -97,7 +97,8 @@ find_backup_file_name (const char *file, enum backup_type backup_type)
if (HAVE_DIR && backup_suffix_size_max < numbered_suffix_size_max)
backup_suffix_size_max = numbered_suffix_size_max;
- s = malloc (file_len + backup_suffix_size_max + numbered_suffix_size_max);
+ s = (char *) malloc (file_len + backup_suffix_size_max
+ + numbered_suffix_size_max);
if (s)
{
strcpy (s, file);
diff --git a/gnulib-local/lib/xalloc.h b/gnulib-local/lib/xalloc.h
index de230eb..a12c984 100644
--- a/gnulib-local/lib/xalloc.h
+++ b/gnulib-local/lib/xalloc.h
@@ -43,6 +43,15 @@ extern void *xcalloc (size_t nmemb, size_t size);
/* Change the size of an allocated block of memory PTR to SIZE bytes,
with error checking. If PTR is NULL, run xmalloc. */
extern void *xrealloc (void *ptr, size_t size);
+#ifdef __cplusplus
+}
+template <typename T>
+ inline T * xrealloc (T * ptr, size_t size)
+ {
+ return (T *) xrealloc((void *) ptr, size);
+ }
+extern "C" {
+#endif
/* This function is always triggered when memory is exhausted. It is
in charge of honoring the three previous items. This is the
diff --git a/gnulib-local/lib/xstrdup.c b/gnulib-local/lib/xstrdup.c
index d73a179..b63af65 100644
--- a/gnulib-local/lib/xstrdup.c
+++ b/gnulib-local/lib/xstrdup.c
@@ -27,5 +27,5 @@
char *
xstrdup (const char *string)
{
- return strcpy (xmalloc (strlen (string) + 1), string);
+ return strcpy ((char *) xmalloc (strlen (string) + 1), string);
}