aboutsummaryrefslogtreecommitdiff
path: root/intl
diff options
context:
space:
mode:
Diffstat (limited to 'intl')
-rw-r--r--intl/dcgettext.c14
-rw-r--r--intl/loadmsgcat.c18
-rw-r--r--intl/localealias.c7
3 files changed, 27 insertions, 12 deletions
diff --git a/intl/dcgettext.c b/intl/dcgettext.c
index 692ce45bcf..3557202ea5 100644
--- a/intl/dcgettext.c
+++ b/intl/dcgettext.c
@@ -142,6 +142,10 @@ static char *stpcpy PARAMS ((char *dest, const char *src));
# define PATH_MAX _POSIX_PATH_MAX
#endif
+#ifndef internal_function
+# define internal_function
+#endif
+
/* XPG3 defines the result of `setlocale (category, NULL)' as:
``Directs `setlocale()' to query `category' and return the current
setting of `local'.''
@@ -168,10 +172,11 @@ struct binding *_nl_domain_bindings;
/* Prototypes for local functions. */
static char *find_msg PARAMS ((struct loaded_l10nfile *domain_file,
- const char *msgid));
-static const char *category_to_name PARAMS ((int category));
+ const char *msgid)) internal_function;
+static const char *category_to_name PARAMS ((int category)) internal_function;
static const char *guess_category_value PARAMS ((int category,
- const char *categoryname));
+ const char *categoryname))
+ internal_function;
/* For those loosing systems which don't have `alloca' we have to add
@@ -394,6 +399,7 @@ weak_alias (__dcgettext, dcgettext);
static char *
+internal_function
find_msg (domain_file, msgid)
struct loaded_l10nfile *domain_file;
const char *msgid;
@@ -482,6 +488,7 @@ find_msg (domain_file, msgid)
/* Return string representation of locale CATEGORY. */
static const char *
+internal_function
category_to_name (category)
int category;
{
@@ -541,6 +548,7 @@ category_to_name (category)
/* Guess value of current locale from value of the environment variables. */
static const char *
+internal_function
guess_category_value (category, categoryname)
int category;
const char *categoryname;
diff --git a/intl/loadmsgcat.c b/intl/loadmsgcat.c
index 43158c4cfa..a67223ff7e 100644
--- a/intl/loadmsgcat.c
+++ b/intl/loadmsgcat.c
@@ -69,6 +69,7 @@ _nl_load_domain (domain_file)
struct loaded_l10nfile *domain_file;
{
int fd;
+ size_t size;
struct stat st;
struct mo_file_header *data = (struct mo_file_header *) -1;
#if (defined HAVE_MMAP && defined HAVE_MUNMAP && !defined DISALLOW_MMAP) \
@@ -94,7 +95,8 @@ _nl_load_domain (domain_file)
/* We must know about the size of the file. */
if (fstat (fd, &st) != 0
- && st.st_size < (off_t) sizeof (struct mo_file_header))
+ || (size = (size_t) st.st_size) != st.st_size
+ || size < sizeof (struct mo_file_header))
{
/* Something went wrong. */
close (fd);
@@ -105,7 +107,7 @@ _nl_load_domain (domain_file)
|| defined _LIBC
/* Now we are ready to load the file. If mmap() is available we try
this first. If not available or it failed we try to load it. */
- data = (struct mo_file_header *) mmap (NULL, st.st_size, PROT_READ,
+ data = (struct mo_file_header *) mmap (NULL, size, PROT_READ,
MAP_PRIVATE, fd, 0);
if (data != (struct mo_file_header *) -1)
@@ -120,14 +122,14 @@ _nl_load_domain (domain_file)
it manually. */
if (data == (struct mo_file_header *) -1)
{
- off_t to_read;
+ size_t to_read;
char *read_ptr;
- data = (struct mo_file_header *) malloc (st.st_size);
+ data = (struct mo_file_header *) malloc (size);
if (data == NULL)
return;
- to_read = st.st_size;
+ to_read = size;
read_ptr = (char *) data;
do
{
@@ -154,7 +156,7 @@ _nl_load_domain (domain_file)
#if (defined HAVE_MMAP && defined HAVE_MUNMAP && !defined DISALLOW_MMAP) \
|| defined _LIBC
if (use_mmap)
- munmap ((caddr_t) data, st.st_size);
+ munmap ((caddr_t) data, size);
else
#endif
free (data);
@@ -169,7 +171,7 @@ _nl_load_domain (domain_file)
domain = (struct loaded_domain *) domain_file->data;
domain->data = (char *) data;
domain->use_mmap = use_mmap;
- domain->mmap_size = st.st_size;
+ domain->mmap_size = size;
domain->must_swap = data->magic != _MAGIC;
/* Fill in the information about the available tables. */
@@ -190,7 +192,7 @@ _nl_load_domain (domain_file)
#if (defined HAVE_MMAP && defined HAVE_MUNMAP && !defined DISALLOW_MMAP) \
|| defined _LIBC
if (use_mmap)
- munmap ((caddr_t) data, st.st_size);
+ munmap ((caddr_t) data, size);
else
#endif
free (data);
diff --git a/intl/localealias.c b/intl/localealias.c
index 46d570f88f..05832f0e36 100644
--- a/intl/localealias.c
+++ b/intl/localealias.c
@@ -90,6 +90,9 @@ void free ();
__libc_lock_define_initialized (static, lock);
#endif
+#ifndef internal_function
+# define internal_function
+#endif
/* For those loosing systems which don't have `alloca' we have to add
some additional code emulating it. */
@@ -143,7 +146,8 @@ static size_t maxmap = 0;
/* Prototypes for local functions. */
-static size_t read_alias_file PARAMS ((const char *fname, int fname_len));
+static size_t read_alias_file PARAMS ((const char *fname, int fname_len))
+ internal_function;
static void extend_alias_table PARAMS ((void));
static int alias_compare PARAMS ((const struct alias_map *map1,
const struct alias_map *map2));
@@ -212,6 +216,7 @@ _nl_expand_alias (name)
static size_t
+internal_function
read_alias_file (fname, fname_len)
const char *fname;
int fname_len;