Index: nsprpub/pr/include/md/_freebsd.h
--- nsprpub/pr/include/md/_freebsd.h.orig	Sat Feb 16 09:12:55 2002
+++ nsprpub/pr/include/md/_freebsd.h	Thu Aug  8 19:31:23 2002
@@ -40,6 +40,7 @@
 #if __FreeBSD__ >= 2
 #include <osreldate.h>  /* for __FreeBSD_version */
 #endif
+#include <sys/param.h>
 #include <sys/syscall.h>
 
 #define PR_LINKER_ARCH	"freebsd"
Index: nsprpub/pr/include/md/_pth.h
--- nsprpub/pr/include/md/_pth.h.orig	2002-12-12 00:10:39 +0100
+++ nsprpub/pr/include/md/_pth.h	2004-12-27 19:52:48 +0100
@@ -90,7 +90,7 @@
 #define _PT_PTHREAD_MUTEXATTR_INIT        pthread_mutexattr_init
 #define _PT_PTHREAD_MUTEXATTR_DESTROY     pthread_mutexattr_destroy
 #define _PT_PTHREAD_MUTEX_INIT(m, a)      pthread_mutex_init(&(m), &(a))
-#define _PT_PTHREAD_MUTEX_IS_LOCKED(m)    (EBUSY == pthread_mutex_trylock(&(m)))
+#define _PT_PTHREAD_MUTEX_IS_LOCKED(m)    (0 != pthread_mutex_trylock(&(m)))
 #if defined(DARWIN)
 #define _PT_PTHREAD_CONDATTR_INIT(x)      0
 #else
Index: nsprpub/pr/src/md/unix/unix.c
--- nsprpub/pr/src/md/unix/unix.c.orig	Sat May 31 18:06:04 2003
+++ nsprpub/pr/src/md/unix/unix.c	Sat May 31 18:04:43 2003
@@ -65,7 +65,8 @@
  * PRInt32* pointer to a _PRSockLen_t* pointer.
  */
 #if defined(HAVE_SOCKLEN_T) \
-    || (defined(LINUX) && defined(__GLIBC__) && __GLIBC__ >= 2)
+    || (defined(LINUX) && defined(__GLIBC__) && __GLIBC__ >= 2) \
+    || defined(FREEBSD)
 #define _PRSockLen_t socklen_t
 #elif defined(IRIX) || defined(HPUX) || defined(OSF1) || defined(SOLARIS) \
     || defined(AIX4_1) || defined(LINUX) || defined(SONY) \
@@ -73,7 +74,7 @@
     || defined(SUNOS4) || defined(NCR) || defined(DARWIN) \
     || defined(NEXTSTEP) || defined(QNX)
 #define _PRSockLen_t int
-#elif (defined(AIX) && !defined(AIX4_1)) || defined(FREEBSD) \
+#elif (defined(AIX) && !defined(AIX4_1)) \
     || defined(NETBSD) || defined(OPENBSD) || defined(UNIXWARE) \
     || defined(DGUX) || defined(VMS) || defined(NTO)
 #define _PRSockLen_t size_t
Index: nsprpub/pr/src/pthreads/ptio.c
--- nsprpub/pr/src/pthreads/ptio.c.orig	2003-07-15 00:12:19 +0200
+++ nsprpub/pr/src/pthreads/ptio.c	2004-12-27 19:54:28 +0100
@@ -189,7 +189,7 @@
 #endif
 #endif
 
-#ifdef DARWIN
+#if defined(DARWIN) || defined(FREEBSD)
 static PRBool _pr_ipv6_v6only_on_by_default;
 /* The IPV6_V6ONLY socket option is not defined on Mac OS X 10.1. */
 #ifndef IPV6_V6ONLY
@@ -1154,7 +1154,7 @@
     _pr_stderr = pt_SetMethods(2, PR_DESC_FILE, PR_FALSE, PR_TRUE);
     PR_ASSERT(_pr_stdin && _pr_stdout && _pr_stderr);
 
-#ifdef DARWIN
+#if defined(DARWIN) || defined(FREEBSD)
     /* In Mac OS X v10.3 Panther Beta the IPV6_V6ONLY socket option
      * is turned on by default, contrary to what RFC 3493, Section
      * 5.3 says.  So we have to turn it off.  Find out whether we
@@ -3462,7 +3462,7 @@
     if (osfd == -1) pt_MapError(_PR_MD_MAP_SOCKET_ERROR, errno);
     else
     {
-#ifdef DARWIN
+#if defined(DARWIN) || defined(FREEBSD)
         if ((domain == AF_INET6) && _pr_ipv6_v6only_on_by_default)
         {
             int on = 0;
@@ -3470,6 +3470,17 @@
                     &on, sizeof(on));
         }
 #endif
+#if (defined(_PR_INET6_PROBE) || defined(_PR_INET6)) && \
+	defined(__FreeBSD__) && defined(IPV6_V6ONLY)
+		if (domain == PR_AF_INET6) {
+			int opt = 0;
+			if (setsockopt(osfd, IPPROTO_IPV6, IPV6_V6ONLY,
+			    &opt, sizeof(opt))) {
+				close(osfd);
+				return NULL;
+			}
+		}
+#endif  
         fd = pt_SetMethods(osfd, ftype, PR_FALSE, PR_FALSE);
         if (fd == NULL) close(osfd);
     }
Index: layout/svg/renderer/src/cairo/nsSVGCairoCanvas.cpp
--- layout/svg/renderer/src/cairo/nsSVGCairoCanvas.cpp.orig	2005-02-04 20:01:59 +0100
+++ layout/svg/renderer/src/cairo/nsSVGCairoCanvas.cpp	2005-02-04 20:02:52 +0100
@@ -50,6 +50,11 @@
 #include "nsRenderingContextGTK.h"
 #include <gdk/gdkx.h>
 #include <cairo.h>
+#ifdef CAIRO_HAS_XLIB_SURFACE
+#include <cairo-xlib.h>
+#else
+#error Require Cairo with Xlib backend
+#endif
 
 /**
  * \addtogroup cairo_renderer Cairo Rendering Engine
Index: layout/svg/renderer/src/cairo/nsSVGCairoGlyphMetrics.cpp
--- layout/svg/renderer/src/cairo/nsSVGCairoGlyphMetrics.cpp.orig	2004-03-16 22:40:07 +0100
+++ layout/svg/renderer/src/cairo/nsSVGCairoGlyphMetrics.cpp	2005-02-04 20:03:40 +0100
@@ -50,6 +50,7 @@
 #include "nsIDOMSVGRect.h"
 #include "nsSVGTypeCIDs.h"
 #include "nsIComponentManager.h"
+#include <stdlib.h>
 #include <cairo.h>
 
 /**
Index: config/make-jars.pl
--- config/make-jars.pl.orig	2004-07-21 20:33:37 +0200
+++ config/make-jars.pl	2005-04-22 20:34:14 +0200
@@ -40,6 +40,7 @@
   last if ($arg eq "--");
 }
 my $defines = join(' ', @ARGV[ $ddindex .. $#ARGV ]);
+splice @ARGV, $ddindex, $#ARGV;
 
 getopts("d:s:t:f:avlD:o:p:xz:");
 

The binutils ld(1) doesn't properly link with Solaris 10 libc(3) anymore,
probably influenced by Sun's new decision to only provide dynamic libraries.
Strangely only a few link tasks fail, so selectively override the otherwise
correct makefiles containing binutils ld(1).
Index: xpcom/tools/registry/Makefile
--- xpcom/tools/registry/Makefile.in.orig	2004-02-19 03:44:01.000000000 +0100
+++ xpcom/tools/registry/Makefile.in	2005-04-27 11:32:16.843943386 +0200
@@ -59,3 +59,13 @@
 
 include $(topsrcdir)/config/rules.mk
 
+# The binutils ld(1) doesn't properly link with Solaris 10 libc(3).
+# Strangely only a few link tasks fail like this one, so selectively
+# override the otherwise correct rules.mk Makefile containing binutils ld(1).
+ifeq ($(OS_ARCH),SunOS)
+OS_LIBS += -lc
+$(PROGRAM): $(PROGOBJS) $(LIBS_DEPS) $(EXTRA_DEPS) Makefile Makefile.in
+	$(LD) -o $@ $(PROGOBJS) $(LDFLAGS) $(LIBS_DIR) $(LIBS) -lxpcom $(OS_LIBS) $(EXTRA_LIBS) $(BIN_FLAGS) $(WRAP_MALLOC_LIB)
+$(SIMPLE_PROGRAMS): %$(BIN_SUFFIX): %.$(OBJ_SUFFIX) $(LIBS_DEPS) $(EXTRA_DEPS) Makefile Makefile.in
+	$(LD) -o $@ $< $(LDFLAGS) $(LIBS_DIR) $(LIBS) -lxpcom $(OS_LIBS) $(EXTRA_LIBS) $(BIN_FLAGS) $(WRAP_MALLOC_LIB)
+endif
Index: widget/src/xremoteclient/Makefile.in
--- widget/src/xremoteclient/Makefile.in.orig	2004-01-07 14:36:56.000000000 +0100
+++ widget/src/xremoteclient/Makefile.in	2005-04-27 11:32:15.926611978 +0200
@@ -73,6 +73,17 @@
 
 include $(topsrcdir)/config/rules.mk
 
+# The binutils ld(1) doesn't properly link with Solaris 10 libc(3).
+# Strangely only a few link tasks fail like this one, so selectively
+# override the otherwise correct rules.mk Makefile containing binutils ld(1).
+ifeq ($(OS_ARCH),SunOS)
+OS_LIBS += -lc
+$(PROGRAM): $(PROGOBJS) $(LIBS_DEPS) $(EXTRA_DEPS) Makefile Makefile.in
+	$(LD) -o $@ $(PROGOBJS) $(LDFLAGS) $(LIBS_DIR) $(LIBS) -lxpcom $(OS_LIBS) $(EXTRA_LIBS) $(BIN_FLAGS) $(WRAP_MALLOC_LIB)
+$(SIMPLE_PROGRAMS): %$(BIN_SUFFIX): %.$(OBJ_SUFFIX) $(LIBS_DEPS) $(EXTRA_DEPS) Makefile Makefile.in
+	$(LD) -o $@ $< $(LDFLAGS) $(LIBS_DIR) $(LIBS) -lxpcom $(OS_LIBS) $(EXTRA_LIBS) $(BIN_FLAGS) $(WRAP_MALLOC_LIB)
+endif
+
 ifeq ($(OS_ARCH), OpenVMS)
 DEFINES		+= -DGENERIC_MOTIF_REDEFINES
 endif
Index: js/src/xpconnect/shell/Makefile.in
--- js/src/xpconnect/shell/Makefile.in.orig	2003-11-15 01:11:10.000000000 +0100
+++ js/src/xpconnect/shell/Makefile.in	2005-04-27 12:09:35.762975909 +0200
@@ -60,6 +60,17 @@
 
 include $(topsrcdir)/config/rules.mk
 
+# The binutils ld(1) doesn't properly link with Solaris 10 libc(3).
+# Strangely only a few link tasks fail like this one, so selectively
+# override the otherwise correct rules.mk Makefile containing binutils ld(1).
+ifeq ($(OS_ARCH),SunOS)
+OS_LIBS += -lc
+$(PROGRAM): $(PROGOBJS) $(LIBS_DEPS) $(EXTRA_DEPS) Makefile Makefile.in
+	$(LD) -o $@ $(PROGOBJS) $(LDFLAGS) $(LIBS_DIR) $(LIBS) $(OS_LIBS) $(EXTRA_LIBS) $(BIN_FLAGS) $(WRAP_MALLOC_LIB)
+$(SIMPLE_PROGRAMS): %$(BIN_SUFFIX): %.$(OBJ_SUFFIX) $(LIBS_DEPS) $(EXTRA_DEPS) Makefile Makefile.in
+	$(LD) -o $@ $< $(LDFLAGS) $(LIBS_DIR) $(LIBS) $(OS_LIBS) $(EXTRA_LIBS) $(BIN_FLAGS) $(WRAP_MALLOC_LIB)
+endif
+
 DEFINES		+= -DJS_THREADSAFE
 
 #
Index: chrome/tools/chromereg/Makefile.in
--- chrome/tools/chromereg/Makefile.in.orig	2003-12-22 21:45:06.000000000 +0100
+++ chrome/tools/chromereg/Makefile.in	2005-04-27 16:21:14.205900993 +0200
@@ -44,3 +44,14 @@
 		$(NULL)
 
 include $(topsrcdir)/config/rules.mk
+
+# The binutils ld(1) doesn't properly link with Solaris 10 libc(3).
+# Strangely only a few link tasks fail like this one, so selectively
+# override the otherwise correct rules.mk Makefile containing binutils ld(1).
+ifeq ($(OS_ARCH),SunOS)
+OS_LIBS += -lc
+$(PROGRAM): $(PROGOBJS) $(LIBS_DEPS) $(EXTRA_DEPS) Makefile Makefile.in
+	$(LD) -o $@ $(PROGOBJS) $(LDFLAGS) $(LIBS_DIR) $(LIBS) $(OS_LIBS) $(EXTRA_LIBS) $(BIN_FLAGS) $(WRAP_MALLOC_LIB)
+$(SIMPLE_PROGRAMS): %$(BIN_SUFFIX): %.$(OBJ_SUFFIX) $(LIBS_DEPS) $(EXTRA_DEPS) Makefile Makefile.in
+	$(LD) -o $@ $< $(LDFLAGS) $(LIBS_DIR) $(LIBS) $(OS_LIBS) $(EXTRA_LIBS) $(BIN_FLAGS) $(WRAP_MALLOC_LIB)
+endif
Index: security/nss/cmd/shlibsign/Makefile
--- security/nss/cmd/shlibsign/Makefile.orig	2003-04-16 00:42:09.000000000 +0200
+++ security/nss/cmd/shlibsign/Makefile	2005-04-27 18:13:37.842242152 +0200
@@ -87,6 +87,17 @@
 
 include $(CORE_DEPTH)/coreconf/rules.mk
 
+# The binutils ld(1) doesn't properly link with Solaris 10 libc(3).
+# Strangely only a few link tasks fail like this one, so selectively
+# override the otherwise correct rules.mk Makefile containing binutils ld(1).
+ifeq ($(OS_ARCH),SunOS)
+OS_LIBS += -lc
+$(PROGRAM): $(PROGOBJS) $(LIBS_DEPS) $(EXTRA_DEPS) Makefile
+	$(LD) -o $@ $(PROGOBJS) $(LDFLAGS) $(LIBS_DIR) $(LIBS) $(OS_LIBS) $(EXTRA_LIBS) $(BIN_FLAGS) $(WRAP_MALLOC_LIB)
+$(SIMPLE_PROGRAMS): %$(BIN_SUFFIX): %.$(OBJ_SUFFIX) $(LIBS_DEPS) $(EXTRA_DEPS) Makefile
+	$(LD) -o $@ $< $(LDFLAGS) $(LIBS_DIR) $(LIBS) $(OS_LIBS) $(EXTRA_LIBS) $(BIN_FLAGS) $(WRAP_MALLOC_LIB)
+endif
+
 #######################################################################
 # (6) Execute "component" rules. (OPTIONAL)                           #
 #######################################################################
@@ -100,8 +110,8 @@
 include ../platrules.mk
 
 %.chk: %.$(DLL_SUFFIX) 
-ifeq ($(OS_TARGET), OS2)
-	@cmd.exe /c sign.cmd $(DIST) $(OBJDIR) $(OS_TARGET) $<
+ifeq ($(OS_TARGET), SunOS)
+	touch `echo $< | cut -f1,1 -d.`.chk
 else
 	@sh ./sign.sh $(DIST) $(OBJDIR) $(OS_TARGET) $<
 endif
Index: security/nss/cmd/shlibsign/mangle/Makefile
--- security/nss/cmd/shlibsign/mangle/Makefile.orig	2003-02-05 00:16:54.000000000 +0100
+++ security/nss/cmd/shlibsign/mangle/Makefile	2005-04-27 16:51:22.816692955 +0200
@@ -61,6 +61,17 @@
 
 include $(CORE_DEPTH)/coreconf/rules.mk
 
+# The binutils ld(1) doesn't properly link with Solaris 10 libc(3).
+# Strangely only a few link tasks fail like this one, so selectively
+# override the otherwise correct rules.mk Makefile containing binutils ld(1).
+ifeq ($(OS_ARCH),SunOS)
+OS_LIBS += -lc
+$(PROGRAM): $(PROGOBJS) $(LIBS_DEPS) $(EXTRA_DEPS) Makefile
+	$(LD) -o $@ $(PROGOBJS) $(LDFLAGS) $(LIBS_DIR) $(LIBS) $(OS_LIBS) $(EXTRA_LIBS) $(BIN_FLAGS) $(WRAP_MALLOC_LIB)
+$(SIMPLE_PROGRAMS): %$(BIN_SUFFIX): %.$(OBJ_SUFFIX) $(LIBS_DEPS) $(EXTRA_DEPS) Makefile
+	$(LD) -o $@ $< $(LDFLAGS) $(LIBS_DIR) $(LIBS) $(OS_LIBS) $(EXTRA_LIBS) $(BIN_FLAGS) $(WRAP_MALLOC_LIB)
+endif
+
 #######################################################################
 # (6) Execute "component" rules. (OPTIONAL)                           #
 #######################################################################
Index: extensions/xmlterm/tests/Makefile.in
--- extensions/xmlterm/tests/Makefile.in.orig	2001-03-10 04:25:14.000000000 +0100
+++ extensions/xmlterm/tests/Makefile.in	2005-04-27 18:34:43.020625605 +0200
@@ -70,3 +70,14 @@
 include $(srcdir)/../config/xmlterm_config.mk
 
 include $(topsrcdir)/config/rules.mk
+
+# The binutils ld(1) doesn't properly link with Solaris 10 libc(3).
+# Strangely only a few link tasks fail like this one, so selectively
+# override the otherwise correct rules.mk Makefile containing binutils ld(1).
+ifeq ($(OS_ARCH),SunOS)
+OS_LIBS += -lc
+$(PROGRAM): $(PROGOBJS) $(LIBS_DEPS) $(EXTRA_DEPS) Makefile Makefile.in
+	$(LD) -o $@ $(PROGOBJS) $(LDFLAGS) $(LIBS_DIR) $(LIBS) $(OS_LIBS) $(EXTRA_LIBS) $(BIN_FLAGS) $(WRAP_MALLOC_LIB)
+$(SIMPLE_PROGRAMS): %$(BIN_SUFFIX): %.$(OBJ_SUFFIX) $(LIBS_DEPS) $(EXTRA_DEPS) Makefile Makefile.in
+	$(LD) -o $@ $< $(LDFLAGS) $(LIBS_DIR) $(LIBS) $(OS_LIBS) $(EXTRA_LIBS) $(BIN_FLAGS) $(WRAP_MALLOC_LIB)
+endif
Index: browser/app/Makefile.in
--- browser/app/Makefile.in.orig	2004-11-07 01:33:34.000000000 +0100
+++ browser/app/Makefile.in	2005-04-27 19:25:12.843462753 +0200
@@ -158,6 +158,19 @@
 include $(topsrcdir)/config/static-rules.mk
 endif
 
+# The binutils ld(1) doesn't properly link with Solaris 10 libc(3).
+# Strangely only a few link tasks fail like this one, so selectively
+# override the otherwise correct rules.mk Makefile containing binutils ld(1).
+ifeq ($(OS_ARCH),SunOS)
+OS_LIBS += -lc
+LDFLAGS += -L@l_gccinst@
+EXTRA_LIBS += -lgcc
+$(PROGRAM): $(PROGOBJS) $(LIBS_DEPS) $(EXTRA_DEPS) Makefile Makefile.in
+	$(LD) -o $@ $(PROGOBJS) $(LDFLAGS) $(LIBS_DIR) $(LIBS) $(OS_LIBS) $(EXTRA_LIBS) $(BIN_FLAGS) $(WRAP_MALLOC_LIB)
+$(SIMPLE_PROGRAMS): %$(BIN_SUFFIX): %.$(OBJ_SUFFIX) $(LIBS_DEPS) $(EXTRA_DEPS) Makefile Makefile.in
+	$(LD) -o $@ $< $(LDFLAGS) $(LIBS_DIR) $(LIBS) $(OS_LIBS) $(EXTRA_LIBS) $(BIN_FLAGS) $(WRAP_MALLOC_LIB)
+endif
+
 APP_VERSION = $(shell cat $(srcdir)/../config/version.txt)
 DEFINES += -DAPP_VERSION=\"$(APP_VERSION)\"
 
Index: embedding/browser/gtk/tests/Makefile.in
--- embedding/browser/gtk/tests/Makefile.in.orig	2003-10-07 04:43:00.000000000 +0200
+++ embedding/browser/gtk/tests/Makefile.in	2005-04-27 19:52:07.615790759 +0200
@@ -114,6 +114,19 @@
 
 include $(topsrcdir)/config/rules.mk
 
+# The binutils ld(1) doesn't properly link with Solaris 10 libc(3).
+# Strangely only a few link tasks fail like this one, so selectively
+# override the otherwise correct rules.mk Makefile containing binutils ld(1).
+ifeq ($(OS_ARCH),SunOS)
+OS_LIBS += -lc
+LDFLAGS += -L@l_gccinst@
+EXTRA_LIBS += -lgcc
+$(PROGRAM): $(PROGOBJS) $(LIBS_DEPS) $(EXTRA_DEPS) Makefile Makefile.in
+	$(LD) -o $@ $(PROGOBJS) $(LDFLAGS) $(LIBS_DIR) $(LIBS) $(OS_LIBS) $(EXTRA_LIBS) $(BIN_FLAGS) $(WRAP_MALLOC_LIB)
+$(SIMPLE_PROGRAMS): %$(BIN_SUFFIX): %.$(OBJ_SUFFIX) $(LIBS_DEPS) $(EXTRA_DEPS) Makefile Makefile.in
+	$(LD) -o $@ $< $(LDFLAGS) $(LIBS_DIR) $(LIBS) $(OS_LIBS) $(EXTRA_LIBS) $(BIN_FLAGS) $(WRAP_MALLOC_LIB)
+endif
+
 CXXFLAGS	+= $(MOZ_GTK_CFLAGS) $(MOZ_GTK2_CFLAGS)
 
 ifdef ENABLE_GNOME

Repair build configuration and replace conflicting identifiers
(like global namespace variable names 'L' or 'R' - a bad idea)
to correct build errors on Solaris x86 and Solaris SPARC.
Index: layout/base/public/nsBidi.h
--- layout/base/public/nsBidi.h.orig	2002-11-23 00:49:26.000000000 +0100
+++ layout/base/public/nsBidi.h	2005-04-27 15:23:33.786839294 +0200
@@ -281,36 +281,36 @@
 #define DIRPROP_FLAG_MULTI_RUNS (1UL<<31)
 
 /* are there any characters that are LTR or RTL? */
-#define MASK_LTR (DIRPROP_FLAG(L)|DIRPROP_FLAG(EN)|DIRPROP_FLAG(AN)|DIRPROP_FLAG(LRE)|DIRPROP_FLAG(LRO))
-#define MASK_RTL (DIRPROP_FLAG(R)|DIRPROP_FLAG(AL)|DIRPROP_FLAG(RLE)|DIRPROP_FLAG(RLO))
+#define MASK_LTR (DIRPROP_FLAG(Moz_L)|DIRPROP_FLAG(Moz_EN)|DIRPROP_FLAG(Moz_AN)|DIRPROP_FLAG(Moz_LRE)|DIRPROP_FLAG(Moz_LRO))
+#define MASK_RTL (DIRPROP_FLAG(Moz_R)|DIRPROP_FLAG(Moz_AL)|DIRPROP_FLAG(Moz_RLE)|DIRPROP_FLAG(Moz_RLO))
 
 /* explicit embedding codes */
-#define MASK_LRX (DIRPROP_FLAG(LRE)|DIRPROP_FLAG(LRO))
-#define MASK_RLX (DIRPROP_FLAG(RLE)|DIRPROP_FLAG(RLO))
-#define MASK_OVERRIDE (DIRPROP_FLAG(LRO)|DIRPROP_FLAG(RLO))
+#define MASK_LRX (DIRPROP_FLAG(Moz_LRE)|DIRPROP_FLAG(Moz_LRO))
+#define MASK_RLX (DIRPROP_FLAG(Moz_RLE)|DIRPROP_FLAG(Moz_RLO))
+#define MASK_OVERRIDE (DIRPROP_FLAG(Moz_LRO)|DIRPROP_FLAG(Moz_RLO))
 
-#define MASK_EXPLICIT (MASK_LRX|MASK_RLX|DIRPROP_FLAG(PDF))
-#define MASK_BN_EXPLICIT (DIRPROP_FLAG(BN)|MASK_EXPLICIT)
+#define MASK_EXPLICIT (MASK_LRX|MASK_RLX|DIRPROP_FLAG(Moz_PDF))
+#define MASK_BN_EXPLICIT (DIRPROP_FLAG(Moz_BN)|MASK_EXPLICIT)
 
 /* paragraph and segment separators */
-#define MASK_B_S (DIRPROP_FLAG(B)|DIRPROP_FLAG(S))
+#define MASK_B_S (DIRPROP_FLAG(Moz_B)|DIRPROP_FLAG(Moz_S))
 
 /* all types that are counted as White Space or Neutral in some steps */
-#define MASK_WS (MASK_B_S|DIRPROP_FLAG(WS)|MASK_BN_EXPLICIT)
-#define MASK_N (DIRPROP_FLAG(O_N)|MASK_WS)
+#define MASK_WS (MASK_B_S|DIRPROP_FLAG(Moz_WS)|MASK_BN_EXPLICIT)
+#define MASK_N (DIRPROP_FLAG(Moz_O_N)|MASK_WS)
 
 /* all types that are included in a sequence of European Terminators for (W5) */
-#define MASK_ET_NSM_BN (DIRPROP_FLAG(ET)|DIRPROP_FLAG(NSM)|MASK_BN_EXPLICIT)
+#define MASK_ET_NSM_BN (DIRPROP_FLAG(Moz_ET)|DIRPROP_FLAG(Moz_NSM)|MASK_BN_EXPLICIT)
 
 /* types that are neutrals or could becomes neutrals in (Wn) */
-#define MASK_POSSIBLE_N (DIRPROP_FLAG(CS)|DIRPROP_FLAG(ES)|DIRPROP_FLAG(ET)|MASK_N)
+#define MASK_POSSIBLE_N (DIRPROP_FLAG(Moz_CS)|DIRPROP_FLAG(Moz_ES)|DIRPROP_FLAG(Moz_ET)|MASK_N)
 
 /*
  * These types may be changed to "e",
  * the embedding type (L or R) of the run,
  * in the Bidi algorithm (N2)
  */
-#define MASK_EMBEDDING (DIRPROP_FLAG(NSM)|MASK_POSSIBLE_N)
+#define MASK_EMBEDDING (DIRPROP_FLAG(Moz_NSM)|MASK_POSSIBLE_N)
 
 /* the dirProp's L and R are defined to 0 and 1 values in nsCharType */
 #define GET_LR_FROM_LEVEL(level) ((DirProp)((level)&1))
@@ -573,18 +573,18 @@
    *      the text must be zero-terminated.
    *
    * @param aParaLevel specifies the default level for the paragraph;
-   *      it is typically 0 (LTR) or 1 (RTL).
+   *      it is typically 0 (Moz_LTR) or 1 (Moz_RTL).
    *      If the function shall determine the paragraph level from the text,
    *      then <code>aParaLevel</code> can be set to
    *      either <code>NSBIDI_DEFAULT_LTR</code>
    *      or <code>NSBIDI_DEFAULT_RTL</code>;
    *      if there is no strongly typed character, then
-   *      the desired default is used (0 for LTR or 1 for RTL).
+   *      the desired default is used (0 for Moz_LTR or 1 for Moz_RTL).
    *      Any other value between 0 and <code>NSBIDI_MAX_EXPLICIT_LEVEL</code> is also valid,
-   *      with odd levels indicating RTL.
+   *      with odd levels indicating Moz_RTL.
    *
    * @param aEmbeddingLevels (in) may be used to preset the embedding and override levels,
-   *      ignoring characters like LRE and PDF in the text.
+   *      ignoring characters like Moz_LRE and Moz_PDF in the text.
    *      A level overrides the directional property of its corresponding
    *      (same index) character if the level has the
    *      <code>NSBIDI_LEVEL_OVERRIDE</code> bit set.<p>
@@ -620,7 +620,7 @@
    * It is not necessary if the paragraph is treated as a single line.<p>
    *
    * After line-breaking, rules (L1) and (L2) for the treatment of
-   * trailing WS and for reordering are performed on
+   * trailing Moz_WS and for reordering are performed on
    * an <code>nsBidi</code> object that represents a line.<p>
    *
    * <strong>Important:</strong> the line <code>nsBidi</code> object shares data with
@@ -946,7 +946,7 @@
 
   /**
    * Give a Unichar
-   * return PR_TRUE if the Unichar is a Bidi control character (LRE, RLE, PDF, LRO, RLO, LRM, RLM)
+   * return PR_TRUE if the Unichar is a Bidi control character (Moz_LRE, Moz_RLE, Moz_PDF, Moz_LRO, Moz_RLO, Moz_LRM, Moz_RLM)
    * return PR_FALSE, otherwise
    */
   PRBool IsBidiControl(PRUnichar aChar);
@@ -978,7 +978,7 @@
   /** the overall paragraph or line directionality - see nsBidiDirection */
   nsBidiDirection mDirection;
 
-  /** characters after trailingWSStart are WS and are */
+  /** characters after trailingWSStart are Moz_WS and are */
   /* implicitly at the paraLevel (rule (L1)) - levels may not reflect that */
   PRInt32 mTrailingWSStart;
 
Index: layout/base/src/nsBidi.cpp
--- layout/base/src/nsBidi.cpp.orig	2005-04-27 14:12:15.099746000 +0200
+++ layout/base/src/nsBidi.cpp	2005-04-27 15:26:21.014728623 +0200
@@ -63,32 +63,32 @@
     is easier with the same names for the Bidi types in the code as there.
 */
 enum { 
-    L =   eCharType_LeftToRight,
-    R =   eCharType_RightToLeft,
-    EN =  eCharType_EuropeanNumber,
-    ES =  eCharType_EuropeanNumberSeparator,
-    ET =  eCharType_EuropeanNumberTerminator,
-    AN =  eCharType_ArabicNumber,
-    CS =  eCharType_CommonNumberSeparator,
-    B =   eCharType_BlockSeparator,
-    S =   eCharType_SegmentSeparator,
-    WS =  eCharType_WhiteSpaceNeutral,
-    O_N = eCharType_OtherNeutral,
-    LRE = eCharType_LeftToRightEmbedding,
-    LRO = eCharType_LeftToRightOverride,
-    AL =  eCharType_RightToLeftArabic,
-    RLE = eCharType_RightToLeftEmbedding,
-    RLO = eCharType_RightToLeftOverride,
-    PDF = eCharType_PopDirectionalFormat,
-    NSM = eCharType_DirNonSpacingMark,
-    BN =  eCharType_BoundaryNeutral,
+    Moz_L =   eCharType_LeftToRight,
+    Moz_R =   eCharType_RightToLeft,
+    Moz_EN =  eCharType_EuropeanNumber,
+    Moz_ES =  eCharType_EuropeanNumberSeparator,
+    Moz_ET =  eCharType_EuropeanNumberTerminator,
+    Moz_AN =  eCharType_ArabicNumber,
+    Moz_CS =  eCharType_CommonNumberSeparator,
+    Moz_B =   eCharType_BlockSeparator,
+    Moz_S =   eCharType_SegmentSeparator,
+    Moz_WS =  eCharType_WhiteSpaceNeutral,
+    Moz_O_N = eCharType_OtherNeutral,
+    Moz_LRE = eCharType_LeftToRightEmbedding,
+    Moz_LRO = eCharType_LeftToRightOverride,
+    Moz_AL =  eCharType_RightToLeftArabic,
+    Moz_RLE = eCharType_RightToLeftEmbedding,
+    Moz_RLO = eCharType_RightToLeftOverride,
+    Moz_PDF = eCharType_PopDirectionalFormat,
+    Moz_NSM = eCharType_DirNonSpacingMark,
+    Moz_BN =  eCharType_BoundaryNeutral,
     dirPropCount
 };
 
 /* to avoid some conditional statements, use tiny constant arrays */
-static Flags flagLR[2]={ DIRPROP_FLAG(L), DIRPROP_FLAG(R) };
-static Flags flagE[2]={ DIRPROP_FLAG(LRE), DIRPROP_FLAG(RLE) };
-static Flags flagO[2]={ DIRPROP_FLAG(LRO), DIRPROP_FLAG(RLO) };
+static Flags flagLR[2]={ DIRPROP_FLAG(Moz_L), DIRPROP_FLAG(Moz_R) };
+static Flags flagE[2]={ DIRPROP_FLAG(Moz_LRE), DIRPROP_FLAG(Moz_RLE) };
+static Flags flagO[2]={ DIRPROP_FLAG(Moz_LRO), DIRPROP_FLAG(Moz_RLO) };
 
 #define DIRPROP_FLAG_LR(level) flagLR[(level)&1]
 #define DIRPROP_FLAG_E(level) flagE[(level)&1]
@@ -348,10 +348,10 @@
       mParaLevel&=1;
     }
     if(aParaLevel&1) {
-      mFlags=DIRPROP_FLAG(R);
+      mFlags=DIRPROP_FLAG(Moz_R);
       mDirection=NSBIDI_RTL;
     } else {
-      mFlags=DIRPROP_FLAG(L);
+      mFlags=DIRPROP_FLAG(Moz_L);
       mDirection=NSBIDI_LTR;
     }
 
@@ -509,14 +509,14 @@
         flags|=DIRPROP_FLAG(dirProps[i]=dirProp=GetCharType(uchar));
       } else {
         /* a surrogate pair */
-        dirProps[i++]=BN;   /* first surrogate in the pair gets the BN type */
-        flags|=DIRPROP_FLAG(dirProps[i]=dirProp=GetCharType(GET_UTF_32(uchar, aText[i])))|DIRPROP_FLAG(BN);
+        dirProps[i++]=Moz_BN;   /* first surrogate in the pair gets the Moz_BN type */
+        flags|=DIRPROP_FLAG(dirProps[i]=dirProp=GetCharType(GET_UTF_32(uchar, aText[i])))|DIRPROP_FLAG(Moz_BN);
       }
       ++i;
-      if(dirProp==L) {
+      if(dirProp==Moz_L) {
         mParaLevel=0;
         break;
-      } else if(dirProp==R || dirProp==AL) {
+      } else if(dirProp==Moz_R || dirProp==Moz_AL) {
         mParaLevel=1;
         break;
       } else if(i==length) {
@@ -539,8 +539,8 @@
       flags|=DIRPROP_FLAG(dirProps[i]=GetCharType(uchar));
     } else {
       /* a surrogate pair */
-      dirProps[i++]=BN;   /* second surrogate in the pair gets the BN type */
-      flags|=DIRPROP_FLAG(dirProps[i]=GetCharType(GET_UTF_32(uchar, aText[i])))|DIRPROP_FLAG(BN);
+      dirProps[i++]=Moz_BN;   /* second surrogate in the pair gets the Moz_BN type */
+      flags|=DIRPROP_FLAG(dirProps[i]=GetCharType(GET_UTF_32(uchar, aText[i])))|DIRPROP_FLAG(Moz_BN);
     }
     ++i;
   }
@@ -590,7 +590,7 @@
  * Handling the stack of explicit levels (Xn):
  *
  * With the Bidi stack of explicit levels,
- * as pushed with each LRE, RLE, LRO, and RLO and popped with each PDF,
+ * as pushed with each Moz_LRE, Moz_RLE, Moz_LRO, and Moz_RLO and popped with each Moz_PDF,
  * the explicit level must never exceed NSBIDI_MAX_EXPLICIT_LEVEL==61.
  *
  * In order to have a correct push-pop semantics even in the case of overflows,
@@ -646,15 +646,15 @@
     for(i=0; i<length; ++i) {
       dirProp=dirProps[i];
       switch(dirProp) {
-        case LRE:
-        case LRO:
+        case Moz_LRE:
+        case Moz_LRO:
           /* (X3, X5) */
           newLevel=(embeddingLevel+2)&~(NSBIDI_LEVEL_OVERRIDE|1);    /* least greater even level */
           if(newLevel<=NSBIDI_MAX_EXPLICIT_LEVEL) {
             stack[stackTop]=embeddingLevel;
             ++stackTop;
             embeddingLevel=newLevel;
-            if(dirProp==LRO) {
+            if(dirProp==Moz_LRO) {
               embeddingLevel|=NSBIDI_LEVEL_OVERRIDE;
             } else {
               embeddingLevel&=~NSBIDI_LEVEL_OVERRIDE;
@@ -664,17 +664,17 @@
           } else /* (embeddingLevel&~NSBIDI_LEVEL_OVERRIDE)==NSBIDI_MAX_EXPLICIT_LEVEL-1 */ {
             ++countOver60;
           }
-          flags|=DIRPROP_FLAG(BN);
+          flags|=DIRPROP_FLAG(Moz_BN);
           break;
-        case RLE:
-        case RLO:
+        case Moz_RLE:
+        case Moz_RLO:
           /* (X2, X4) */
           newLevel=((embeddingLevel&~NSBIDI_LEVEL_OVERRIDE)+1)|1;    /* least greater odd level */
           if(newLevel<=NSBIDI_MAX_EXPLICIT_LEVEL) {
             stack[stackTop]=embeddingLevel;
             ++stackTop;
             embeddingLevel=newLevel;
-            if(dirProp==RLO) {
+            if(dirProp==Moz_RLO) {
               embeddingLevel|=NSBIDI_LEVEL_OVERRIDE;
             } else {
               embeddingLevel&=~NSBIDI_LEVEL_OVERRIDE;
@@ -682,15 +682,15 @@
           } else {
             ++countOver61;
           }
-          flags|=DIRPROP_FLAG(BN);
+          flags|=DIRPROP_FLAG(Moz_BN);
           break;
-        case PDF:
+        case Moz_PDF:
           /* (X7) */
           /* handle all the overflow cases first */
           if(countOver61>0) {
             --countOver61;
           } else if(countOver60>0 && (embeddingLevel&~NSBIDI_LEVEL_OVERRIDE)!=NSBIDI_MAX_EXPLICIT_LEVEL) {
-            /* handle LRx overflows from level 60 */
+            /* handle Moz_LRx overflows from level 60 */
             --countOver60;
           } else if(stackTop>0) {
             /* this is the pop operation; it also pops level 61 while countOver60>0 */
@@ -698,23 +698,23 @@
             embeddingLevel=stack[stackTop];
             /* } else { (underflow) */
           }
-          flags|=DIRPROP_FLAG(BN);
+          flags|=DIRPROP_FLAG(Moz_BN);
           break;
-        case B:
+        case Moz_B:
           /*
-           * We do not really expect to see a paragraph separator (B),
+           * We do not really expect to see a paragraph separator (Moz_B),
            * but we should do something reasonable with it,
            * especially at the end of the text.
            */
           stackTop=0;
           countOver60=countOver61=0;
           embeddingLevel=level=mParaLevel;
-          flags|=DIRPROP_FLAG(B);
+          flags|=DIRPROP_FLAG(Moz_B);
           break;
-        case BN:
-          /* BN, LRE, RLE, and PDF are supposed to be removed (X9) */
+        case Moz_BN:
+          /* Moz_BN, Moz_LRE, Moz_RLE, and Moz_PDF are supposed to be removed (X9) */
           /* they will get their levels set correctly in AdjustWSLevels() */
-          flags|=DIRPROP_FLAG(BN);
+          flags|=DIRPROP_FLAG(Moz_BN);
           break;
         default:
           /* all other types get the "real" level */
@@ -733,7 +733,7 @@
       }
 
       /*
-       * We need to set reasonable levels even on BN codes and
+       * We need to set reasonable levels even on Moz_BN codes and
        * explicit codes because we will later look at same-level runs (X10).
        */
       levels[i]=level;
@@ -742,7 +742,7 @@
       flags|=DIRPROP_FLAG_LR(mParaLevel);
     }
 
-    /* subsequently, ignore the explicit codes and BN (X9) */
+    /* subsequently, ignore the explicit codes and Moz_BN (X9) */
 
     /* again, determine if the text is mixed-directional or single-directional */
     mFlags=flags;
@@ -799,8 +799,8 @@
 /* determine if the text is mixed-directional or single-directional */
 nsBidiDirection nsBidi::DirectionFromFlags(Flags aFlags)
 {
-  /* if the text contains AN and neutrals, then some neutrals may become RTL */
-  if(!(aFlags&MASK_RTL || aFlags&DIRPROP_FLAG(AN) && aFlags&MASK_POSSIBLE_N)) {
+  /* if the text contains Moz_AN and neutrals, then some neutrals may become Moz_RTL */
+  if(!(aFlags&MASK_RTL || aFlags&DIRPROP_FLAG(Moz_AN) && aFlags&MASK_POSSIBLE_N)) {
     return NSBIDI_LTR;
   } else if(!(aFlags&MASK_LTR)) {
     return NSBIDI_RTL;
@@ -891,73 +891,73 @@
 
     /* (W1..W7) */
     switch(dirProp) {
-      case L:
-        lastStrong=L;
+      case Moz_L:
+        lastStrong=Moz_L;
         break;
-      case R:
-        lastStrong=R;
+      case Moz_R:
+        lastStrong=Moz_R;
         break;
-      case AL:
+      case Moz_AL:
         /* (W3) */
-        lastStrong=AL;
-        dirProp=R;
+        lastStrong=Moz_AL;
+        dirProp=Moz_R;
         break;
-      case EN:
+      case Moz_EN:
         /* we have to set historyOfEN correctly */
-        if(lastStrong==AL) {
+        if(lastStrong==Moz_AL) {
           /* (W2) */
-          dirProp=AN;
+          dirProp=Moz_AN;
         } else {
-          if(lastStrong==L) {
+          if(lastStrong==Moz_L) {
             /* (W7) */
-            dirProp=L;
+            dirProp=Moz_L;
           }
-          /* this EN stays after (W2) and (W4) - at least before (W7) */
+          /* this Moz_EN stays after (W2) and (W4) - at least before (W7) */
           historyOfEN|=EN_ALL;
         }
         break;
-      case ES:
-        if( historyOfEN&PREV_EN_AFTER_W2 &&     /* previous was EN before (W4) */
-            nextDirProp==EN && lastStrong!=AL   /* next is EN and (W2) won't make it AN */
+      case Moz_ES:
+        if( historyOfEN&PREV_EN_AFTER_W2 &&     /* previous was Moz_EN before (W4) */
+            nextDirProp==Moz_EN && lastStrong!=Moz_AL   /* next is EN and (W2) won't make it Moz_AN */
           ) {
           /* (W4) */
-          if(lastStrong!=L) {
-            dirProp=EN;
+          if(lastStrong!=Moz_L) {
+            dirProp=Moz_EN;
           } else {
             /* (W7) */
-            dirProp=L;
+            dirProp=Moz_L;
           }
           historyOfEN|=EN_AFTER_W4;
         } else {
           /* (W6) */
-          dirProp=O_N;
+          dirProp=Moz_O_N;
         }
         break;
-      case CS:
-        if( historyOfEN&PREV_EN_AFTER_W2 &&     /* previous was EN before (W4) */
-            nextDirProp==EN && lastStrong!=AL   /* next is EN and (W2) won't make it AN */
+      case Moz_CS:
+        if( historyOfEN&PREV_EN_AFTER_W2 &&     /* previous was Moz_EN before (W4) */
+            nextDirProp==Moz_EN && lastStrong!=Moz_AL   /* next is Moz_EN and (W2) won't make it Moz_AN */
           ) {
           /* (W4) */
-          if(lastStrong!=L) {
-            dirProp=EN;
+          if(lastStrong!=Moz_L) {
+            dirProp=Moz_EN;
           } else {
             /* (W7) */
-            dirProp=L;
+            dirProp=Moz_L;
           }
           historyOfEN|=EN_AFTER_W4;
-        } else if(prevDirProp==AN &&                    /* previous was AN */
-              (nextDirProp==AN ||                   /* next is AN */
-               nextDirProp==EN && lastStrong==AL)   /* or (W2) will make it one */
+        } else if(prevDirProp==Moz_AN &&                    /* previous was Moz_AN */
+              (nextDirProp==Moz_AN ||                   /* next is Moz_AN */
+               nextDirProp==Moz_EN && lastStrong==Moz_AL)   /* or (W2) will make it one */
              ) {
           /* (W4) */
-          dirProp=AN;
+          dirProp=Moz_AN;
         } else {
           /* (W6) */
-          dirProp=O_N;
+          dirProp=Moz_O_N;
         }
         break;
-      case ET:
-        /* get sequence of ET; advance only next, not current, previous or historyOfEN */
+      case Moz_ET:
+        /* get sequence of Moz_ET; advance only next, not current, previous or historyOfEN */
         while(next<aLimit && DIRPROP_FLAG(nextDirProp)&MASK_ET_NSM_BN /* (W1), (X9) */) {
           if(++next<aLimit) {
             nextDirProp=dirProps[next];
@@ -967,31 +967,31 @@
           }
         }
 
-        if( historyOfEN&PREV_EN_AFTER_W4 ||     /* previous was EN before (W5) */
-            nextDirProp==EN && lastStrong!=AL   /* next is EN and (W2) won't make it AN */
+        if( historyOfEN&PREV_EN_AFTER_W4 ||     /* previous was Moz_EN before (W5) */
+            nextDirProp==Moz_EN && lastStrong!=Moz_AL   /* next is Moz_EN and (W2) won't make it Moz_AN */
           ) {
           /* (W5) */
-          if(lastStrong!=L) {
-            dirProp=EN;
+          if(lastStrong!=Moz_L) {
+            dirProp=Moz_EN;
           } else {
             /* (W7) */
-            dirProp=L;
+            dirProp=Moz_L;
           }
         } else {
           /* (W6) */
-          dirProp=O_N;
+          dirProp=Moz_O_N;
         }
 
         /* apply the result of (W1), (W5)..(W7) to the entire sequence of ET */
         break;
-      case NSM:
+      case Moz_NSM:
         /* (W1) */
         dirProp=prevDirProp;
         /* set historyOfEN back to prevDirProp's historyOfEN */
         historyOfEN>>=EN_SHIFT;
         /*
          * Technically, this should be done before the switch() in the form
-         *      if(nextDirProp==NSM) {
+         *      if(nextDirProp==Moz_NSM) {
          *          dirProps[next]=nextDirProp=dirProp;
          *      }
          *
@@ -1004,9 +1004,9 @@
         break;
     }
 
-    /* here, it is always [prev,this,next]dirProp!=BN; it may be next>i+1 */
+    /* here, it is always [prev,this,next]dirProp!=Moz_BN; it may be next>i+1 */
 
-    /* perform (Nn) - here, only L, R, EN, AN, and neutrals are left */
+    /* perform (Nn) - here, only Moz_L, Moz_R, Moz_EN, Moz_AN, and neutrals are left */
     /* this is one iteration late for the neutrals */
     if(DIRPROP_FLAG(dirProp)&MASK_N) {
       if(neutralStart<0) {
@@ -1014,7 +1014,7 @@
         neutralStart=i;
         beforeNeutral=prevDirProp;
       }
-    } else /* not a neutral, can be only one of { L, R, EN, AN } */ {
+    } else /* not a neutral, can be only one of { Moz_L, Moz_R, Moz_EN, Moz_AN } */ {
       /*
        * Note that all levels[] values are still the same at this
        * point because this function is called for an entire
@@ -1026,17 +1026,17 @@
       if(neutralStart>=0) {
         nsBidiLevel final;
         /* end of a sequence of neutrals (dirProp is "afterNeutral") */
-        if(beforeNeutral==L) {
-          if(dirProp==L) {
-            final=0;                /* make all neutrals L (N1) */
+        if(beforeNeutral==Moz_L) {
+          if(dirProp==Moz_L) {
+            final=0;                /* make all neutrals Moz_L (N1) */
           } else {
             final=level;            /* make all neutrals "e" (N2) */
           }
-        } else /* beforeNeutral is one of { R, EN, AN } */ {
-          if(dirProp==L) {
+        } else /* beforeNeutral is one of { Moz_R, Moz_EN, Moz_AN } */ {
+          if(dirProp==Moz_L) {
             final=level;            /* make all neutrals "e" (N2) */
           } else {
-            final=1;                /* make all neutrals R (N1) */
+            final=1;                /* make all neutrals Moz_R (N1) */
           }
         }
         /* perform (In) on the sequence of neutrals */
@@ -1051,24 +1051,24 @@
 
       /* perform (In) on the non-neutral character */
       /*
-       * in the cases of (W5), processing a sequence of ET,
-       * and of (X9), skipping BN,
+       * in the cases of (W5), processing a sequence of Moz_ET,
+       * and of (X9), skipping Moz_BN,
        * there may be multiple characters from i to <next
        * that all get (virtually) the same dirProp and (really) the same level
        */
-      if(dirProp==L) {
+      if(dirProp==Moz_L) {
         if(level&1) {
           ++level;
         } else {
           i=next;     /* we keep the levels */
         }
-      } else if(dirProp==R) {
+      } else if(dirProp==Moz_R) {
         if(!(level&1)) {
           ++level;
         } else {
           i=next;     /* we keep the levels */
         }
-      } else /* EN or AN */ {
+      } else /* Moz_EN or Moz_AN */ {
         level=(level+2)&~1;     /* least greater even level */
       }
 
@@ -1080,7 +1080,7 @@
   }
 
   /* perform (Nn) - here,
-  the character after the the neutrals is aEOR, which is either L or R */
+  the character after the the neutrals is aEOR, which is either Moz_L or Moz_R */
   /* this is one iteration late for the neutrals */
   if(neutralStart>=0) {
     /*
@@ -1092,17 +1092,17 @@
     nsBidiLevel level=levels[neutralStart], final;
 
     /* end of a sequence of neutrals (aEOR is "afterNeutral") */
-    if(beforeNeutral==L) {
-      if(aEOR==L) {
-        final=0;                /* make all neutrals L (N1) */
+    if(beforeNeutral==Moz_L) {
+      if(aEOR==Moz_L) {
+        final=0;                /* make all neutrals Moz_L (N1) */
       } else {
         final=level;            /* make all neutrals "e" (N2) */
       }
-    } else /* beforeNeutral is one of { R, EN, AN } */ {
-      if(aEOR==L) {
+    } else /* beforeNeutral is one of { Moz_R, Moz_EN, Moz_AN } */ {
+      if(aEOR==Moz_L) {
         final=level;            /* make all neutrals "e" (N2) */
       } else {
-        final=1;                /* make all neutrals R (N1) */
+        final=1;                /* make all neutrals Moz_R (N1) */
       }
     }
     /* perform (In) on the sequence of neutrals */
@@ -1140,7 +1140,7 @@
         levels[i]=paraLevel;
       }
 
-      /* reset BN to the next character's paraLevel until B/S, which restarts above loop */
+      /* reset Moz_BN to the next character's paraLevel until B/S, which restarts above loop */
       /* here, i+1 is guaranteed to be <length */
       while(i>0) {
         flag=DIRPROP_FLAG(dirProps[--i]);
Index: calendar/libxpical/token.c
--- calendar/libxpical/token.c.orig	2003-10-24 22:40:32 +0200
+++ calendar/libxpical/token.c	2005-08-13 13:13:58 +0200
@@ -266,7 +266,7 @@
     unsigned char seed[16];
 
     get_random_info(seed);
-    seed[0] |= 0x80;
+    seed[0] |= 0x01;
     memcpy(node, seed, sizeof(*node));
 }
 
Index: security/nss/lib/pki1/oiddata.h
--- security/nss/lib/pki1/oiddata.h.orig	2002-01-04 06:22:07 +0100
+++ security/nss/lib/pki1/oiddata.h	2005-10-06 08:23:42 +0200
@@ -39,6 +39,9 @@
 static const char OIDDATA_CVS_ID[] = "@(#) $RCSfile: oiddata.h,v $ $Revision: 1.1 $ $Date: 2002/01/04 05:22:07 $ $Name: FIREFOX_1_0_7_RELEASE $ ; @(#) $RCSfile: oiddata.h,v $ $Revision: 1.1 $ $Date: 2002/01/04 05:22:07 $ $Name: FIREFOX_1_0_7_RELEASE $";
 #endif /* DEBUG */
 
+#ifndef PKI1T_H
+#include "pki1t.h"
+#endif
 #ifndef NSSPKI1T_H
 #include "nsspki1t.h"
 #endif /* NSSPKI1T_H */
