Skip to content

Commit

Permalink
Bug 1119469: update NSPR to NSPR_4_10_8_BETA2 r=ted
Browse files Browse the repository at this point in the history
Uplifts bugs 1106600, 1105144, 1072454, 1107063, 756047, 782113, 1060292, 573192 and 1060401
  • Loading branch information
landryb committed Jan 9, 2015
1 parent 10471e9 commit b68cad4
Show file tree
Hide file tree
Showing 26 changed files with 221 additions and 127 deletions.
2 changes: 1 addition & 1 deletion nsprpub/TAG-INFO
Original file line number Diff line number Diff line change
@@ -1 +1 @@
NSPR_4_10_7_RTM
NSPR_4_10_8_BETA2
1 change: 0 additions & 1 deletion nsprpub/config/prdepend.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,3 @@
*/

#error "Do not include this header file."

8 changes: 6 additions & 2 deletions nsprpub/config/rules.mk
Original file line number Diff line number Diff line change
Expand Up @@ -83,15 +83,19 @@ ifeq (,$(filter-out WINNT WINCE OS2,$(OS_ARCH)))
ifeq (,$(filter-out WIN95 WINCE WINMO OS2,$(OS_TARGET)))
LIBRARY = $(OBJDIR)/$(LIBRARY_NAME)$(LIBRARY_VERSION)_s.$(LIB_SUFFIX)
SHARED_LIBRARY = $(OBJDIR)/$(LIBRARY_NAME)$(LIBRARY_VERSION).$(DLL_SUFFIX)
IMPORT_LIBRARY = $(OBJDIR)/$(LIBRARY_NAME)$(LIBRARY_VERSION).$(LIB_SUFFIX)
SHARED_LIB_PDB = $(OBJDIR)/$(LIBRARY_NAME)$(LIBRARY_VERSION).pdb
else
LIBRARY = $(OBJDIR)/lib$(LIBRARY_NAME)$(LIBRARY_VERSION)_s.$(LIB_SUFFIX)
SHARED_LIBRARY = $(OBJDIR)/lib$(LIBRARY_NAME)$(LIBRARY_VERSION).$(DLL_SUFFIX)
IMPORT_LIBRARY = $(OBJDIR)/lib$(LIBRARY_NAME)$(LIBRARY_VERSION).$(LIB_SUFFIX)
SHARED_LIB_PDB = $(OBJDIR)/lib$(LIBRARY_NAME)$(LIBRARY_VERSION).pdb
endif

ifdef MSC_VER
IMPORT_LIBRARY = $(OBJDIR)/$(LIBRARY_NAME)$(LIBRARY_VERSION).$(LIB_SUFFIX)
else
IMPORT_LIBRARY = $(OBJDIR)/lib$(LIBRARY_NAME)$(LIBRARY_VERSION).$(LIB_SUFFIX)
endif

else

LIBRARY = $(OBJDIR)/lib$(LIBRARY_NAME)$(LIBRARY_VERSION).$(LIB_SUFFIX)
Expand Down
4 changes: 2 additions & 2 deletions nsprpub/configure
Original file line number Diff line number Diff line change
Expand Up @@ -2489,7 +2489,7 @@ test -n "$target_alias" &&
MOD_MAJOR_VERSION=4
MOD_MINOR_VERSION=10
MOD_PATCH_VERSION=7
MOD_PATCH_VERSION=8
NSPR_MODNAME=nspr20
_HAVE_PTHREADS=
USE_PTHREADS=
Expand Down Expand Up @@ -7382,7 +7382,7 @@ $as_echo "$as_me: WARNING: Unknown version of the Microsoft (R) Manifest Tool."
if test -z "$USE_NSPR_THREADS"; then
USE_PTHREADS=1
fi
DSO_LDOPTS='-shared -fPIC'
DSO_LDOPTS='-shared -fPIC -Wl,-soname,$(notdir $@)'
MKSHLIB='$(CC) $(DSO_LDOPTS) -o $@'
;;
Expand Down
4 changes: 2 additions & 2 deletions nsprpub/configure.in
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ dnl = Defaults
dnl ========================================================
MOD_MAJOR_VERSION=4
MOD_MINOR_VERSION=10
MOD_PATCH_VERSION=7
MOD_PATCH_VERSION=8
NSPR_MODNAME=nspr20
_HAVE_PTHREADS=
USE_PTHREADS=
Expand Down Expand Up @@ -2178,7 +2178,7 @@ tools are selected during the Xcode/Developer Tools installation.])
if test -z "$USE_NSPR_THREADS"; then
USE_PTHREADS=1
fi
DSO_LDOPTS='-shared -fPIC'
DSO_LDOPTS='-shared -fPIC -Wl,-soname,$(notdir $@)'
MKSHLIB='$(CC) $(DSO_LDOPTS) -o $@'
;;

Expand Down
141 changes: 141 additions & 0 deletions nsprpub/pr/include/md/_freebsd.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -251,6 +251,147 @@
#define PR_ALIGN_OF_POINTER 8
#define PR_ALIGN_OF_WORD 8

#elif defined(__powerpc64__)

#undef IS_LITTLE_ENDIAN
#define IS_BIG_ENDIAN 1
#define IS_64

#define PR_BYTES_PER_BYTE 1
#define PR_BYTES_PER_SHORT 2
#define PR_BYTES_PER_INT 4
#define PR_BYTES_PER_INT64 8
#define PR_BYTES_PER_LONG 8
#define PR_BYTES_PER_FLOAT 4
#define PR_BYTES_PER_DOUBLE 8
#define PR_BYTES_PER_WORD 8
#define PR_BYTES_PER_DWORD 8

#define PR_BITS_PER_BYTE 8
#define PR_BITS_PER_SHORT 16
#define PR_BITS_PER_INT 32
#define PR_BITS_PER_INT64 64
#define PR_BITS_PER_LONG 64
#define PR_BITS_PER_FLOAT 32
#define PR_BITS_PER_DOUBLE 64
#define PR_BITS_PER_WORD 64

#define PR_BITS_PER_BYTE_LOG2 3
#define PR_BITS_PER_SHORT_LOG2 4
#define PR_BITS_PER_INT_LOG2 5
#define PR_BITS_PER_INT64_LOG2 6
#define PR_BITS_PER_LONG_LOG2 6
#define PR_BITS_PER_FLOAT_LOG2 5
#define PR_BITS_PER_DOUBLE_LOG2 6
#define PR_BITS_PER_WORD_LOG2 6

#define PR_ALIGN_OF_SHORT 2
#define PR_ALIGN_OF_INT 4
#define PR_ALIGN_OF_LONG 8
#define PR_ALIGN_OF_INT64 8
#define PR_ALIGN_OF_FLOAT 4
#define PR_ALIGN_OF_DOUBLE 8
#define PR_ALIGN_OF_POINTER 8
#define PR_ALIGN_OF_WORD 8

#define PR_BYTES_PER_WORD_LOG2 3
#define PR_BYTES_PER_DWORD_LOG2 3

#elif defined(__powerpc__)

#undef IS_LITTLE_ENDIAN
#define IS_BIG_ENDIAN 1

#define PR_BYTES_PER_BYTE 1
#define PR_BYTES_PER_SHORT 2
#define PR_BYTES_PER_INT 4
#define PR_BYTES_PER_INT64 8
#define PR_BYTES_PER_LONG 4
#define PR_BYTES_PER_FLOAT 4
#define PR_BYTES_PER_DOUBLE 8
#define PR_BYTES_PER_WORD 4
#define PR_BYTES_PER_DWORD 8

#define PR_BITS_PER_BYTE 8
#define PR_BITS_PER_SHORT 16
#define PR_BITS_PER_INT 32
#define PR_BITS_PER_INT64 64
#define PR_BITS_PER_LONG 32
#define PR_BITS_PER_FLOAT 32
#define PR_BITS_PER_DOUBLE 64
#define PR_BITS_PER_WORD 32

#define PR_BITS_PER_BYTE_LOG2 3
#define PR_BITS_PER_SHORT_LOG2 4
#define PR_BITS_PER_INT_LOG2 5
#define PR_BITS_PER_INT64_LOG2 6
#define PR_BITS_PER_LONG_LOG2 5
#define PR_BITS_PER_FLOAT_LOG2 5
#define PR_BITS_PER_DOUBLE_LOG2 6
#define PR_BITS_PER_WORD_LOG2 5

#define PR_ALIGN_OF_SHORT 2
#define PR_ALIGN_OF_INT 4
#define PR_ALIGN_OF_LONG 4
#define PR_ALIGN_OF_INT64 8
#define PR_ALIGN_OF_FLOAT 4
#define PR_ALIGN_OF_DOUBLE 8
#define PR_ALIGN_OF_POINTER 4
#define PR_ALIGN_OF_WORD 4

#define PR_BYTES_PER_WORD_LOG2 2
#define PR_BYTES_PER_DWORD_LOG2 3

#elif defined(__arm__)

#if defined(__ARMEB__) || defined(__ARM_BIG_ENDIAN__)
#undef IS_LITTLE_ENDIAN
#define IS_BIG_ENDIAN 1
#else
#undef IS_BIG_ENDIAN
#define IS_LITTLE_ENDIAN 1
#endif

#define PR_BYTES_PER_BYTE 1
#define PR_BYTES_PER_SHORT 2
#define PR_BYTES_PER_INT 4
#define PR_BYTES_PER_INT64 8
#define PR_BYTES_PER_LONG 4
#define PR_BYTES_PER_FLOAT 4
#define PR_BYTES_PER_DOUBLE 8
#define PR_BYTES_PER_WORD 4
#define PR_BYTES_PER_DWORD 8

#define PR_BITS_PER_BYTE 8
#define PR_BITS_PER_SHORT 16
#define PR_BITS_PER_INT 32
#define PR_BITS_PER_INT64 64
#define PR_BITS_PER_LONG 32
#define PR_BITS_PER_FLOAT 32
#define PR_BITS_PER_DOUBLE 64
#define PR_BITS_PER_WORD 32

#define PR_BITS_PER_BYTE_LOG2 3
#define PR_BITS_PER_SHORT_LOG2 4
#define PR_BITS_PER_INT_LOG2 5
#define PR_BITS_PER_INT64_LOG2 6
#define PR_BITS_PER_LONG_LOG2 5
#define PR_BITS_PER_FLOAT_LOG2 5
#define PR_BITS_PER_DOUBLE_LOG2 6
#define PR_BITS_PER_WORD_LOG2 5

#define PR_ALIGN_OF_SHORT 2
#define PR_ALIGN_OF_INT 4
#define PR_ALIGN_OF_LONG 4
#define PR_ALIGN_OF_INT64 8
#define PR_ALIGN_OF_FLOAT 4
#define PR_ALIGN_OF_DOUBLE 8
#define PR_ALIGN_OF_POINTER 4
#define PR_ALIGN_OF_WORD 4

#define PR_BYTES_PER_WORD_LOG2 2
#define PR_BYTES_PER_DWORD_LOG2 3

#else

#error "Unknown CPU architecture"
Expand Down
6 changes: 6 additions & 0 deletions nsprpub/pr/include/md/_freebsd.h
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,12 @@
#define _PR_SI_ARCHITECTURE "ia64"
#elif defined(__amd64__)
#define _PR_SI_ARCHITECTURE "amd64"
#elif defined(__powerpc64__)
#define _PR_SI_ARCHITECTURE "powerpc64"
#elif defined(__powerpc__)
#define _PR_SI_ARCHITECTURE "powerpc"
#elif defined(__arm__)
#define _PR_SI_ARCHITECTURE "arm"
#else
#error "Unknown CPU architecture"
#endif
Expand Down
6 changes: 3 additions & 3 deletions nsprpub/pr/include/prinit.h
Original file line number Diff line number Diff line change
Expand Up @@ -31,11 +31,11 @@ PR_BEGIN_EXTERN_C
** The format of the version string is
** "<major version>.<minor version>[.<patch level>] [<Beta>]"
*/
#define PR_VERSION "4.10.7"
#define PR_VERSION "4.10.8 Beta"
#define PR_VMAJOR 4
#define PR_VMINOR 10
#define PR_VPATCH 7
#define PR_BETA PR_FALSE
#define PR_VPATCH 8
#define PR_BETA PR_TRUE

/*
** PRVersionCheck
Expand Down
2 changes: 1 addition & 1 deletion nsprpub/pr/src/cplus/rcnetdb.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ RCNetAddr::RCNetAddr(RCNetAddr::HostValue host, PRUint16 port): RCBase()
{
case RCNetAddr::any: how = PR_IpAddrAny; break;
case RCNetAddr::loopback: how = PR_IpAddrLoopback; break;
default: PR_ASSERT(!"This can't happen -- and did!");
default: PR_NOT_REACHED("This can't happen -- and did!");
}
(void)PR_InitializeNetAddr(how, port, &address);
} /* RCNetAddr::RCNetAddr */
Expand Down
79 changes: 9 additions & 70 deletions nsprpub/pr/src/io/prfdcach.c
Original file line number Diff line number Diff line change
Expand Up @@ -31,13 +31,11 @@ typedef struct _PR_Fd_Cache
{
PRLock *ml;
PRIntn count;
PRStack *stack;
PRFileDesc *head, *tail;
PRIntn limit_low, limit_high;
} _PR_Fd_Cache;

static _PR_Fd_Cache _pr_fd_cache;
static PRFileDesc **stack2fd = &(((PRFileDesc*)NULL)->higher);


/*
Expand All @@ -59,11 +57,7 @@ PRFileDesc *_PR_Getfd(void)
*/
if (0 == _pr_fd_cache.limit_high)
{
PRStackElem *pop;
PR_ASSERT(NULL != _pr_fd_cache.stack);
pop = PR_StackPop(_pr_fd_cache.stack);
if (NULL == pop) goto allocate;
fd = (PRFileDesc*)((PRPtrdiff)pop - (PRPtrdiff)stack2fd);
goto allocate;
}
else
{
Expand Down Expand Up @@ -128,18 +122,9 @@ void _PR_Putfd(PRFileDesc *fd)
fd->identity = PR_INVALID_IO_LAYER;
fd->secret->state = _PR_FILEDESC_FREED;

if (0 == _pr_fd_cache.limit_high)
{
PR_StackPush(_pr_fd_cache.stack, (PRStackElem*)(&fd->higher));
}
else
if (0 != _pr_fd_cache.limit_high)
{
if (_pr_fd_cache.count > _pr_fd_cache.limit_high)
{
PR_Free(fd->secret);
PR_Free(fd);
}
else
if (_pr_fd_cache.count < _pr_fd_cache.limit_high)
{
PR_Lock(_pr_fd_cache.ml);
if (NULL == _pr_fd_cache.tail)
Expand All @@ -157,8 +142,12 @@ void _PR_Putfd(PRFileDesc *fd)
fd->higher = NULL; /* always so */
_pr_fd_cache.count += 1; /* count the new entry */
PR_Unlock(_pr_fd_cache.ml);
return;
}
}

PR_Free(fd->secret);
PR_Free(fd);
} /* _PR_Putfd */

PR_IMPLEMENT(PRStatus) PR_SetFDCacheSize(PRIntn low, PRIntn high)
Expand All @@ -173,48 +162,8 @@ PR_IMPLEMENT(PRStatus) PR_SetFDCacheSize(PRIntn low, PRIntn high)
if (low > high) low = high; /* sanity check the params */

PR_Lock(_pr_fd_cache.ml);
if (0 == high) /* shutting down or staying down */
{
if (0 != _pr_fd_cache.limit_high) /* shutting down */
{
_pr_fd_cache.limit_high = 0; /* stop use */
/*
** Hold the lock throughout - nobody's going to want it
** other than another caller to this routine. Just don't
** let that happen.
**
** Put all the cached fds onto the new cache.
*/
while (NULL != _pr_fd_cache.head)
{
PRFileDesc *fd = _pr_fd_cache.head;
_pr_fd_cache.head = fd->higher;
PR_StackPush(_pr_fd_cache.stack, (PRStackElem*)(&fd->higher));
}
_pr_fd_cache.limit_low = 0;
_pr_fd_cache.tail = NULL;
_pr_fd_cache.count = 0;
}
}
else /* starting up or just adjusting parameters */
{
PRBool was_using_stack = (0 == _pr_fd_cache.limit_high);
_pr_fd_cache.limit_low = low;
_pr_fd_cache.limit_high = high;
if (was_using_stack) /* was using stack - feed into cache */
{
PRStackElem *pop;
while (NULL != (pop = PR_StackPop(_pr_fd_cache.stack)))
{
PRFileDesc *fd = (PRFileDesc*)
((PRPtrdiff)pop - (PRPtrdiff)stack2fd);
if (NULL == _pr_fd_cache.tail) _pr_fd_cache.tail = fd;
fd->higher = _pr_fd_cache.head;
_pr_fd_cache.head = fd;
_pr_fd_cache.count += 1;
}
}
}
_pr_fd_cache.limit_high = high;
_pr_fd_cache.limit_low = low;
PR_Unlock(_pr_fd_cache.ml);
return PR_SUCCESS;
} /* PR_SetFDCacheSize */
Expand Down Expand Up @@ -258,8 +207,6 @@ void _PR_InitFdCache(void)

_pr_fd_cache.ml = PR_NewLock();
PR_ASSERT(NULL != _pr_fd_cache.ml);
_pr_fd_cache.stack = PR_CreateStack("FD");
PR_ASSERT(NULL != _pr_fd_cache.stack);

} /* _PR_InitFdCache */

Expand All @@ -279,14 +226,6 @@ void _PR_CleanupFdCache(void)
_pr_fd_cache.count = 0;
PR_DestroyLock(_pr_fd_cache.ml);
_pr_fd_cache.ml = NULL;
while ((pop = PR_StackPop(_pr_fd_cache.stack)) != NULL)
{
fd = (PRFileDesc*)((PRPtrdiff)pop - (PRPtrdiff)stack2fd);
PR_DELETE(fd->secret);
PR_DELETE(fd);
}
PR_DestroyStack(_pr_fd_cache.stack);
_pr_fd_cache.stack = NULL;
} /* _PR_CleanupFdCache */

/* prfdcach.c */
Loading

0 comments on commit b68cad4

Please sign in to comment.