about summary refs log tree commit diff
path: root/locale/loadlocale.c
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>1999-09-13 09:07:36 +0000
committerUlrich Drepper <drepper@redhat.com>1999-09-13 09:07:36 +0000
commit4a33c2f55eab04206e22ab972a77f62486fe5a97 (patch)
tree3f4efea20d66878b81d2ba1587e16a3133ef65f7 /locale/loadlocale.c
parent3e95f6602b226e0de06aaff686dc47b282d7cc16 (diff)
downloadglibc-4a33c2f55eab04206e22ab972a77f62486fe5a97.tar.gz
glibc-4a33c2f55eab04206e22ab972a77f62486fe5a97.tar.xz
glibc-4a33c2f55eab04206e22ab972a77f62486fe5a97.zip
Update.
1999-09-13  Ulrich Drepper  <drepper@cygnus.com>

	* locale/langinfo.h: Remove byte-order dependent names.
	* locale/categories.def: Update after removal of byte-order dependent
	names.
	* locale/loadlocale.c (_nl_load_locale): Don't allow locale files
	with magic number in other byte order.
	* locale/newlocale.c (__newlocale): Remove byte-order dependent code.
	* locale/C-collate.c: Remove initializers for other byte-order.
	* locale/C-ctype.c: Likewise.
	* locale/C-monetary.c: Likewise.
	* locale/C-paper.c: Likewise.
	* locale/C-time.c: Likewise.
	* locale/lc-collate.c: Remove byte-order oriented initialization.
	* locale/lc-ctype.c: Likewise.
	* locale/lc-monetary.c: Likewise.
	* locale/lc-time.c: Likewise.
	* locale/programs/ld-address.c: Don't generate output in both
	byte-orders.
	* locale/programs/ld-ctype.c: Likewise.
	* locale/programs/ld-paper.c: Likewise.
	* locale/programs/ld-time.c: Likewise.
	* time/strftime.c (NLW): Don't use different byte-orders.
	* wctype/cname-lookup.h (cname_lookup): Likewise.

	* Makeconfig (localedir): Define using libdir, not datadir.
	(msgcatdir): New variable.
	* catgets/Makefile (CPPFLAGS): Define NLSPATH using msgcatdir.
	* elf/Makefile (bash-ldd-rewrite): Replace @TEXTDOMAINDIR@ using
	msgcatdir.
	* intl/Makefile (install-others): Install locale.alias in msgcatdir.
	(CPPFLAGS): Define paths using msgcatdir.
	* locale/Makefile (CPPFLAGS): Define LOCALE_ALIAS_PATH using msgcatdir.
	* po/Makefile (mo-installed): Define using msgcatdir.

	* sysdeps/unix/sysv/linux/net/if_arp.h: Fix typo.
Diffstat (limited to 'locale/loadlocale.c')
-rw-r--r--locale/loadlocale.c41
1 files changed, 11 insertions, 30 deletions
diff --git a/locale/loadlocale.c b/locale/loadlocale.c
index 121798782e..d829309f9f 100644
--- a/locale/loadlocale.c
+++ b/locale/loadlocale.c
@@ -18,7 +18,6 @@
    write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
    Boston, MA 02111-1307, USA.  */
 
-#include <byteswap.h>
 #include <errno.h>
 #include <fcntl.h>
 #include <stdlib.h>
@@ -70,15 +69,8 @@ _nl_load_locale (struct loaded_l10nfile *file, int category)
   struct stat st;
   struct locale_data *newdata;
   int save_err;
-  int swap = 0;
   int mmaped = 1;
   size_t cnt;
-  inline unsigned int SWAP (const unsigned int *inw)
-    {
-      if (!swap)
-	return *inw;
-      return bswap_32 (*inw);
-    }
 
   file->decided = 1;
   file->data = NULL;
@@ -164,28 +156,18 @@ _nl_load_locale (struct loaded_l10nfile *file, int category)
     /* This cannot be a locale data file since it's too small.  */
     goto puntfd;
 
-  if (filedata->magic == LIMAGIC (category))
-    /* Good data file in our byte order.  */
-    swap = 0;
-  else
+  if (filedata->magic != LIMAGIC (category))
+    /* Bad data file in either byte order.  */
     {
-      /* Try the other byte order.  */
-      swap = 1;
-      if (SWAP (&filedata->magic) != LIMAGIC (category))
-	/* Bad data file in either byte order.  */
-	{
-	puntmap:
-	  __munmap ((caddr_t) filedata, st.st_size);
-	puntfd:
-	  __close (fd);
-	  return;
-	}
+    puntmap:
+      __munmap ((caddr_t) filedata, st.st_size);
+    puntfd:
+      __close (fd);
+      return;
     }
 
-#define W(word)	SWAP (&(word))
-
-  if (W (filedata->nstrings) < _nl_category_num_items[category] ||
-      (sizeof *filedata + W (filedata->nstrings) * sizeof (unsigned int)
+  if (filedata->nstrings < _nl_category_num_items[category] ||
+      (sizeof *filedata + filedata->nstrings * sizeof (unsigned int)
        >= (size_t) st.st_size))
     {
       /* Insufficient data.  */
@@ -207,7 +189,7 @@ _nl_load_locale (struct loaded_l10nfile *file, int category)
   newdata->nstrings = _nl_category_num_items[category];
   for (cnt = 0; cnt < newdata->nstrings; ++cnt)
     {
-      off_t idx = W (filedata->strindex[cnt]);
+      off_t idx = filedata->strindex[cnt];
       if (idx >= newdata->filesize)
 	{
 	  free (newdata);
@@ -215,8 +197,7 @@ _nl_load_locale (struct loaded_l10nfile *file, int category)
 	  goto puntmap;
 	}
       if (_nl_value_types[category][cnt] == word)
-	newdata->values[cnt].word = W (*((u_int32_t *) (newdata->filedata
-							+ idx)));
+	newdata->values[cnt].word = *((u_int32_t *) (newdata->filedata + idx));
       else
 	newdata->values[cnt].string = newdata->filedata + idx;
     }