summaryrefslogtreecommitdiff
path: root/lib/libc
diff options
context:
space:
mode:
Diffstat (limited to 'lib/libc')
-rw-r--r--lib/libc/src/Makefile.in29
-rw-r--r--lib/libc/src/base64.c2
-rw-r--r--lib/libc/src/plc.def94
-rw-r--r--lib/libc/src/plc_symvec.opt53
-rw-r--r--lib/libc/src/strccmp.c32
-rw-r--r--lib/libc/src/strstr.c6
6 files changed, 195 insertions, 21 deletions
diff --git a/lib/libc/src/Makefile.in b/lib/libc/src/Makefile.in
index 2977399e..17a4dfa1 100644
--- a/lib/libc/src/Makefile.in
+++ b/lib/libc/src/Makefile.in
@@ -69,7 +69,11 @@ LIBRARY_VERSION = $(MOD_MAJOR_VERSION)
RELEASE_LIBS = $(TARGETS)
ifeq ($(OS_ARCH),WINNT)
+ifdef NS_USE_GCC
+DLLBASE=-Wl,--image-base -Wl,0x30000000
+else
DLLBASE=/BASE:0x30000000
+endif
RES=$(OBJDIR)/plc.res
RESNAME=plc.rc
endif # WINNT
@@ -86,6 +90,27 @@ ifeq ($(OS_ARCH),IRIX)
OS_LIBS = -lc
endif
+ifeq ($(OS_ARCH),SunOS)
+OS_LIBS = -lc
+MAPFILE = $(OBJDIR)/plcmap.sun
+GARBAGE += $(MAPFILE)
+ifdef NS_USE_GCC
+ifdef GCC_USE_GNU_LD
+MKSHLIB += -Wl,--version-script,$(MAPFILE)
+else
+MKSHLIB += -Wl,-M,$(MAPFILE)
+endif
+else
+MKSHLIB += -M $(MAPFILE)
+endif
+endif
+
+ifeq ($(OS_ARCH),OS2)
+MAPFILE = $(OBJDIR)/$(LIBRARY_NAME)$(LIBRARY_VERSION).def
+GARBAGE += $(MAPFILE)
+MKSHLIB += $(MAPFILE)
+endif
+
EXTRA_LIBS = $(LIBNSPR)
# On NCR and SCOOS, we can't link with extra libraries when
@@ -115,7 +140,7 @@ NOW = $(MOD_DEPTH)/config/$(OBJDIR)/now
SH_DATE = $(shell date "+%Y-%m-%d %T")
SH_NOW = $(shell $(NOW))
-ifeq ($(OS_ARCH), WINNT)
+ifeq ($(NS_USE_GCC)_$(OS_ARCH),_WINNT)
SUF = i64
else
SUF = LL
@@ -135,7 +160,7 @@ $(TINC):
$(OBJDIR)/plvrsion.$(OBJ_SUFFIX): plvrsion.c $(TINC)
-ifeq ($(OS_ARCH), WINNT)
+ifeq ($(NS_USE_GCC)_$(OS_ARCH),_WINNT)
$(CC) -Fo$@ -c $(CFLAGS) -I$(OBJDIR) $<
else
ifeq ($(MOZ_OS2_TOOLS), VACPP)
diff --git a/lib/libc/src/base64.c b/lib/libc/src/base64.c
index 749965f7..00f19ab2 100644
--- a/lib/libc/src/base64.c
+++ b/lib/libc/src/base64.c
@@ -383,7 +383,7 @@ PL_Base64Decode
srclen = PL_strlen(src);
}
- if( 0 == (srclen & 3) )
+ if( srclen && (0 == (srclen & 3)) )
{
if( (char)'=' == src[ srclen-1 ] )
{
diff --git a/lib/libc/src/plc.def b/lib/libc/src/plc.def
new file mode 100644
index 00000000..39eba5b7
--- /dev/null
+++ b/lib/libc/src/plc.def
@@ -0,0 +1,94 @@
+;+#
+;+# The contents of this file are subject to the Mozilla Public
+;+# License Version 1.1 (the "License"); you may not use this file
+;+# except in compliance with the License. You may obtain a copy of
+;+# the License at http://www.mozilla.org/MPL/
+;+#
+;+# Software distributed under the License is distributed on an "AS
+;+# IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+;+# implied. See the License for the specific language governing
+;+# rights and limitations under the License.
+;+#
+;+# The Original Code is the Netscape Portable Runtime (NSPR).
+;+#
+;+# The Initial Developer of the Original Code is Netscape
+;+# Communications Corporation. Portions created by Netscape are
+;+# Copyright (C) 2002-2003 Netscape Communications Corporation. All
+;+# Rights Reserved.
+;+#
+;+# Contributor(s):
+;+#
+;+# Alternatively, the contents of this file may be used under the
+;+# terms of the GNU General Public License Version 2 or later (the
+;+# "GPL"), in which case the provisions of the GPL are applicable
+;+# instead of those above. If you wish to allow use of your
+;+# version of this file only under the terms of the GPL and not to
+;+# allow others to use your version of this file under the MPL,
+;+# indicate your decision by deleting the provisions above and
+;+# replace them with the notice and other provisions required by
+;+# the GPL. If you do not delete the provisions above, a recipient
+;+# may use your version of this file under either the MPL or the
+;+# GPL.
+;+#
+;+# OK, this file is meant to support SUN, LINUX, AIX, OS/2 and WINDOWS
+;+# 1. For all unix platforms, the string ";-" means "remove this line"
+;+# 2. For all unix platforms, the string " DATA " will be removed from any
+;+# line on which it occurs.
+;+# 3. Lines containing ";+" will have ";+" removed on SUN and LINUX.
+;+# On AIX, lines containing ";+" will be removed.
+;+# 4. For all unix platforms, the string ";;" will thave the ";;" removed.
+;+# 5. For all unix platforms, after the above processing has taken place,
+;+# all characters after the first ";" on the line will be removed.
+;+# And for AIX, the first ";" will also be removed.
+;+# This file is passed directly to windows. Since ';' is a comment, all UNIX
+;+# directives are hidden behind ";", ";+", and ";-"
+;+NSPR_4.0 {
+;+ global:
+LIBRARY plc4 ;-
+EXPORTS ;-
+PL_Base64Decode;
+PL_Base64Encode;
+PL_CreateOptState;
+PL_DestroyOptState;
+PL_FPrintError;
+PL_GetNextOpt;
+PL_PrintError;
+PL_strcasecmp;
+PL_strcaserstr;
+PL_strcasestr;
+PL_strcat;
+PL_strcatn;
+PL_strchr;
+PL_strcmp;
+PL_strcpy;
+PL_strdup;
+PL_strfree;
+PL_strlen;
+PL_strncasecmp;
+PL_strncaserstr;
+PL_strncasestr;
+PL_strncat;
+PL_strnchr;
+PL_strncmp;
+PL_strncpy;
+PL_strncpyz;
+PL_strndup;
+PL_strnlen;
+PL_strnpbrk;
+PL_strnprbrk;
+PL_strnrchr;
+PL_strnrstr;
+PL_strnstr;
+PL_strpbrk;
+PL_strprbrk;
+PL_strrchr;
+PL_strrstr;
+PL_strstr;
+libVersionPoint;
+;+ local: *;
+;+};
+;+
+;+NSPR_4.2 {
+;+ global:
+PL_strtok_r;
+;+} NSPR_4.0;
diff --git a/lib/libc/src/plc_symvec.opt b/lib/libc/src/plc_symvec.opt
new file mode 100644
index 00000000..8bc769e0
--- /dev/null
+++ b/lib/libc/src/plc_symvec.opt
@@ -0,0 +1,53 @@
+! Fixed section of symbol vector for LIBPLC4
+!
+GSMATCH=LEQUAL,2,2
+case_sensitive=YES
+!
+! --------------------------------------------------------------------------
+! Ident 2,2 introduced for Mozilla 1.3
+! Previously this was empty. Now we include everything that's specified in
+! plc.def.
+! --------------------------------------------------------------------------
+!
+! NSPR 4.0
+SYMBOL_VECTOR=(PL_Base64Decode=PROCEDURE)
+SYMBOL_VECTOR=(PL_Base64Encode=PROCEDURE)
+SYMBOL_VECTOR=(PL_CreateOptState=PROCEDURE)
+SYMBOL_VECTOR=(PL_DestroyOptState=PROCEDURE)
+SYMBOL_VECTOR=(PL_FPrintError=PROCEDURE)
+SYMBOL_VECTOR=(PL_GetNextOpt=PROCEDURE)
+SYMBOL_VECTOR=(PL_PrintError=PROCEDURE)
+SYMBOL_VECTOR=(PL_strcasecmp=PROCEDURE)
+SYMBOL_VECTOR=(PL_strcaserstr=PROCEDURE)
+SYMBOL_VECTOR=(PL_strcasestr=PROCEDURE)
+SYMBOL_VECTOR=(PL_strcat=PROCEDURE)
+SYMBOL_VECTOR=(PL_strcatn=PROCEDURE)
+SYMBOL_VECTOR=(PL_strchr=PROCEDURE)
+SYMBOL_VECTOR=(PL_strcmp=PROCEDURE)
+SYMBOL_VECTOR=(PL_strcpy=PROCEDURE)
+SYMBOL_VECTOR=(PL_strdup=PROCEDURE)
+SYMBOL_VECTOR=(PL_strfree=PROCEDURE)
+SYMBOL_VECTOR=(PL_strlen=PROCEDURE)
+SYMBOL_VECTOR=(PL_strncasecmp=PROCEDURE)
+SYMBOL_VECTOR=(PL_strncaserstr=PROCEDURE)
+SYMBOL_VECTOR=(PL_strncasestr=PROCEDURE)
+SYMBOL_VECTOR=(PL_strncat=PROCEDURE)
+SYMBOL_VECTOR=(PL_strnchr=PROCEDURE)
+SYMBOL_VECTOR=(PL_strncmp=PROCEDURE)
+SYMBOL_VECTOR=(PL_strncpy=PROCEDURE)
+SYMBOL_VECTOR=(PL_strncpyz=PROCEDURE)
+SYMBOL_VECTOR=(PL_strndup=PROCEDURE)
+SYMBOL_VECTOR=(PL_strnlen=PROCEDURE)
+SYMBOL_VECTOR=(PL_strnpbrk=PROCEDURE)
+SYMBOL_VECTOR=(PL_strnprbrk=PROCEDURE)
+SYMBOL_VECTOR=(PL_strnrchr=PROCEDURE)
+SYMBOL_VECTOR=(PL_strnrstr=PROCEDURE)
+SYMBOL_VECTOR=(PL_strnstr=PROCEDURE)
+SYMBOL_VECTOR=(PL_strpbrk=PROCEDURE)
+SYMBOL_VECTOR=(PL_strprbrk=PROCEDURE)
+SYMBOL_VECTOR=(PL_strrchr=PROCEDURE)
+SYMBOL_VECTOR=(PL_strrstr=PROCEDURE)
+SYMBOL_VECTOR=(PL_strstr=PROCEDURE)
+SYMBOL_VECTOR=(libVersionPoint=PROCEDURE)
+! NSPR 4.2
+SYMBOL_VECTOR=(PL_strtok_r=PROCEDURE)
diff --git a/lib/libc/src/strccmp.c b/lib/libc/src/strccmp.c
index 25d53e59..2ec20cee 100644
--- a/lib/libc/src/strccmp.c
+++ b/lib/libc/src/strccmp.c
@@ -52,22 +52,22 @@ static const unsigned char uc[] =
'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O',
'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W',
'X', 'Y', 'Z', '{', '|', '}', '~', '\177',
- '\200', '\201', '\202', '\203', '\204', '\205', '\206', '\207',
- '\210', '\211', '\212', '\213', '\214', '\215', '\216', '\217',
- '\220', '\221', '\222', '\223', '\224', '\225', '\226', '\227',
- '\230', '\231', '\232', '\233', '\234', '\235', '\236', '\237',
- '\240', '\241', '\242', '\243', '\244', '\245', '\246', '\247',
- '\250', '\251', '\252', '\253', '\254', '\255', '\256', '\257',
- '\260', '\261', '\262', '\263', '\264', '\265', '\266', '\267',
- '\270', '\271', '\272', '\273', '\274', '\275', '\276', '\277',
- '\300', '\301', '\302', '\303', '\304', '\305', '\306', '\307',
- '\310', '\311', '\312', '\313', '\314', '\315', '\316', '\317',
- '\320', '\321', '\322', '\323', '\324', '\325', '\326', '\327',
- '\330', '\331', '\332', '\333', '\334', '\335', '\336', '\337',
- '\340', '\341', '\342', '\343', '\344', '\345', '\346', '\347',
- '\350', '\351', '\352', '\353', '\354', '\355', '\356', '\357',
- '\360', '\361', '\362', '\363', '\364', '\365', '\366', '\367',
- '\370', '\371', '\372', '\373', '\374', '\375', '\376', '\377'
+ 0200, 0201, 0202, 0203, 0204, 0205, 0206, 0207,
+ 0210, 0211, 0212, 0213, 0214, 0215, 0216, 0217,
+ 0220, 0221, 0222, 0223, 0224, 0225, 0226, 0227,
+ 0230, 0231, 0232, 0233, 0234, 0235, 0236, 0237,
+ 0240, 0241, 0242, 0243, 0244, 0245, 0246, 0247,
+ 0250, 0251, 0252, 0253, 0254, 0255, 0256, 0257,
+ 0260, 0261, 0262, 0263, 0264, 0265, 0266, 0267,
+ 0270, 0271, 0272, 0273, 0274, 0275, 0276, 0277,
+ 0300, 0301, 0302, 0303, 0304, 0305, 0306, 0307,
+ 0310, 0311, 0312, 0313, 0314, 0315, 0316, 0317,
+ 0320, 0321, 0322, 0323, 0324, 0325, 0326, 0327,
+ 0330, 0331, 0332, 0333, 0334, 0335, 0336, 0337,
+ 0340, 0341, 0342, 0343, 0344, 0345, 0346, 0347,
+ 0350, 0351, 0352, 0353, 0354, 0355, 0356, 0357,
+ 0360, 0361, 0362, 0363, 0364, 0365, 0366, 0367,
+ 0370, 0371, 0372, 0373, 0374, 0375, 0376, 0377
};
PR_IMPLEMENT(PRIntn)
diff --git a/lib/libc/src/strstr.c b/lib/libc/src/strstr.c
index 3f38a34f..fe658c1b 100644
--- a/lib/libc/src/strstr.c
+++ b/lib/libc/src/strstr.c
@@ -57,13 +57,15 @@ PL_strrstr(const char *big, const char *little)
{
const char *p;
PRUint32 ll;
+ PRUint32 bl;
if( ((const char *)0 == big) || ((const char *)0 == little) ) return (char *)0;
if( ((char)0 == *big) || ((char)0 == *little) ) return (char *)0;
ll = PL_strlen(little);
- p = &big[ PL_strlen(big) - ll ];
- if( p < big ) return (char *)0;
+ bl = PL_strlen(big);
+ if( bl < ll ) return (char *)0;
+ p = &big[ bl - ll ];
for( ; p >= big; p-- )
if( *little == *p )