This commit is contained in:
Wan-Teh Chang 2008-10-11 10:46:10 -07:00
Родитель 697a20f3ae
Коммит 2c5ff6c233
7 изменённых файлов: 74 добавлений и 16 удалений

2
nsprpub/configure поставляемый
Просмотреть файл

@ -6016,7 +6016,7 @@ s%\[%\\&%g
s%\]%\\&%g
s%\$%$$%g
EOF
DEFS=`sed -f conftest.defs confdefs.h | tr '\012' ' '`
DEFS=`sed -f conftest.defs confdefs.h | tr '\012' ' ' | tr '\015' ' '`
rm -f conftest.defs

Просмотреть файл

@ -331,6 +331,52 @@
#define PR_BYTES_PER_WORD_LOG2 2
#define PR_BYTES_PER_DWORD_LOG2 3
#elif defined(__sparc__) && defined (__arch64__)
#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_INT64 8
#define PR_ALIGN_OF_LONG 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(__sparc__)
#undef IS_LITTLE_ENDIAN

Просмотреть файл

@ -63,6 +63,8 @@
#define _PR_SI_ARCHITECTURE "x86-64"
#elif defined(__mc68000__)
#define _PR_SI_ARCHITECTURE "m68k"
#elif defined(__sparc__) && defined(__arch64__)
#define _PR_SI_ARCHITECTURE "sparc64"
#elif defined(__sparc__)
#define _PR_SI_ARCHITECTURE "sparc"
#elif defined(__i386__)

Просмотреть файл

@ -63,7 +63,7 @@ PR_BEGIN_EXTERN_C
** The format of the version string is
** "<major version>.<minor version>[.<patch level>] [<Beta>]"
*/
#define PR_VERSION "4.7.2 Beta 3"
#define PR_VERSION "4.7.2 Beta 4"
#define PR_VMAJOR 4
#define PR_VMINOR 7
#define PR_VPATCH 2

Просмотреть файл

@ -145,39 +145,39 @@ GetHighResClock(void *buf, size_t maxbytes)
#include <sys/stat.h>
#include <fcntl.h>
static int fdDevRandom;
static PRCallOnceType coOpenDevRandom;
static int fdDevURandom;
static PRCallOnceType coOpenDevURandom;
static PRStatus OpenDevRandom( void )
static PRStatus OpenDevURandom( void )
{
fdDevRandom = open( "/dev/random", O_RDONLY );
return((-1 == fdDevRandom)? PR_FAILURE : PR_SUCCESS );
} /* end OpenDevRandom() */
fdDevURandom = open( "/dev/urandom", O_RDONLY );
return((-1 == fdDevURandom)? PR_FAILURE : PR_SUCCESS );
} /* end OpenDevURandom() */
static size_t GetDevRandom( void *buf, size_t size )
static size_t GetDevURandom( void *buf, size_t size )
{
int bytesIn;
int rc;
rc = PR_CallOnce( &coOpenDevRandom, OpenDevRandom );
rc = PR_CallOnce( &coOpenDevURandom, OpenDevURandom );
if ( PR_FAILURE == rc ) {
_PR_MD_MAP_OPEN_ERROR( errno );
return(0);
}
bytesIn = read( fdDevRandom, buf, size );
bytesIn = read( fdDevURandom, buf, size );
if ( -1 == bytesIn ) {
_PR_MD_MAP_READ_ERROR( errno );
return(0);
}
return( bytesIn );
} /* end GetDevRandom() */
} /* end GetDevURandom() */
static size_t
GetHighResClock(void *buf, size_t maxbytes)
{
return(GetDevRandom( buf, maxbytes ));
return(GetDevURandom( buf, maxbytes ));
}
#elif defined(NCR)

Просмотреть файл

@ -300,14 +300,14 @@ PR_IMPLEMENT(PRUint64) PR_GetPhysicalMemorySize(void)
#elif defined(DARWIN)
struct host_basic_info hInfo;
mach_msg_type_number_t count;
mach_msg_type_number_t count = HOST_BASIC_INFO_COUNT;
int result = host_info(mach_host_self(),
HOST_BASIC_INFO,
(host_info_t) &hInfo,
&count);
if (result == KERN_SUCCESS)
bytes = hInfo.memory_size;
bytes = hInfo.max_mem;
#elif defined(WIN32)

Просмотреть файл

@ -1696,6 +1696,7 @@ PR_ParseTimeString(
PR_IMPLEMENT(PRUint32)
PR_FormatTime(char *buf, int buflen, const char *fmt, const PRExplodedTime *tm)
{
size_t rv;
struct tm a;
a.tm_sec = tm->tm_sec;
a.tm_min = tm->tm_min;
@ -1719,7 +1720,16 @@ PR_FormatTime(char *buf, int buflen, const char *fmt, const PRExplodedTime *tm)
a.tm_gmtoff = tm->tm_params.tp_gmt_offset + tm->tm_params.tp_dst_offset;
#endif
return strftime(buf, buflen, fmt, &a);
rv = strftime(buf, buflen, fmt, &a);
if (!rv && buf && buflen > 0) {
/*
* When strftime fails, the contents of buf are indeterminate.
* Some callers don't check the return value from this function,
* so store an empty string in buf in case they try to print it.
*/
buf[0] = '\0';
}
return rv;
}