зеркало из https://github.com/mozilla/gecko-dev.git
Bug 456449: updated NSPR to NSPR_HEAD_20090204.
This commit is contained in:
Родитель
107220ad15
Коммит
66184c6720
|
@ -64,10 +64,10 @@
|
|||
#
|
||||
# ------------------------------------------------------------------
|
||||
|
||||
FROMTOP=/share/builds/components/nspr20/v4.7.4
|
||||
TOTOP=./v4.7.4
|
||||
NSPRDIR=nspr-4.7.4
|
||||
SOURCETAG=NSPR_4_7_4_RTM
|
||||
FROMTOP=/share/builds/components/nspr20/v4.8
|
||||
TOTOP=./v4.8
|
||||
NSPRDIR=nspr-4.8
|
||||
SOURCETAG=NSPR_4_8_RTM
|
||||
|
||||
#
|
||||
# enumerate Unix object directories on /s/b/c
|
||||
|
|
|
@ -688,8 +688,8 @@ test "$host_alias" != "$target_alias" &&
|
|||
|
||||
|
||||
MOD_MAJOR_VERSION=4
|
||||
MOD_MINOR_VERSION=7
|
||||
MOD_PATCH_VERSION=4
|
||||
MOD_MINOR_VERSION=8
|
||||
MOD_PATCH_VERSION=0
|
||||
NSPR_MODNAME=nspr20
|
||||
_HAVE_PTHREADS=
|
||||
USE_PTHREADS=
|
||||
|
@ -6070,7 +6070,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
|
||||
|
||||
|
||||
|
|
|
@ -49,8 +49,8 @@ dnl ========================================================
|
|||
dnl = Defaults
|
||||
dnl ========================================================
|
||||
MOD_MAJOR_VERSION=4
|
||||
MOD_MINOR_VERSION=7
|
||||
MOD_PATCH_VERSION=4
|
||||
MOD_MINOR_VERSION=8
|
||||
MOD_PATCH_VERSION=0
|
||||
NSPR_MODNAME=nspr20
|
||||
_HAVE_PTHREADS=
|
||||
USE_PTHREADS=
|
||||
|
|
|
@ -52,7 +52,8 @@
|
|||
#define HAVE_LONG_LONG
|
||||
#endif
|
||||
|
||||
#if defined(__i386__) || defined(__arm32__) || defined(__MIPSEL__)
|
||||
#if defined(__i386__) || defined(__arm32__) || defined(__ARMEL__) || \
|
||||
defined(__MIPSEL__)
|
||||
|
||||
#define IS_LITTLE_ENDIAN 1
|
||||
#undef IS_BIG_ENDIAN
|
||||
|
@ -97,12 +98,58 @@
|
|||
#define PR_ALIGN_OF_DOUBLE 4
|
||||
#define PR_ALIGN_OF_POINTER 4
|
||||
|
||||
#elif defined(__sparc__) || defined(__MIPSEB__)
|
||||
#elif defined(__sparc_v9__)
|
||||
|
||||
#undef IS_LITTLE_ENDIAN
|
||||
#define IS_BIG_ENDIAN 1
|
||||
#define HAVE_ALIGNED_DOUBLES
|
||||
#define HAVE_ALIGNED_LONGLONGS
|
||||
#undef IS_LITTLE_ENDIAN
|
||||
#define IS_BIG_ENDIAN 1
|
||||
#define HAVE_ALIGNED_DOUBLES
|
||||
#define HAVE_ALIGNED_LONGLONGS
|
||||
#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_BYTES_PER_WORD_LOG2 3
|
||||
#define PR_BYTES_PER_DWORD_LOG2 3
|
||||
|
||||
#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
|
||||
|
||||
#elif defined(__sparc__) || defined(__MIPSEB__) || defined(__ARMEB__)
|
||||
|
||||
#undef IS_LITTLE_ENDIAN
|
||||
#define IS_BIG_ENDIAN 1
|
||||
#define HAVE_ALIGNED_DOUBLES
|
||||
#define HAVE_ALIGNED_LONGLONGS
|
||||
|
||||
#define PR_BYTES_PER_BYTE 1
|
||||
#define PR_BYTES_PER_SHORT 2
|
||||
|
@ -188,6 +235,53 @@
|
|||
#define PR_BYTES_PER_WORD_LOG2 3
|
||||
#define PR_BYTES_PER_DWORD_LOG2 3
|
||||
|
||||
#elif defined(__amd64__)
|
||||
#define IS_LITTLE_ENDIAN 1
|
||||
#undef IS_BIG_ENDIAN
|
||||
#define HAVE_ALIGNED_DOUBLES
|
||||
#define HAVE_ALIGNED_LONGLONGS
|
||||
#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__) || defined(__m68k__)
|
||||
|
||||
#undef IS_LITTLE_ENDIAN
|
||||
|
|
|
@ -47,6 +47,8 @@
|
|||
#define _PR_SI_ARCHITECTURE "x86"
|
||||
#elif defined(__alpha__)
|
||||
#define _PR_SI_ARCHITECTURE "alpha"
|
||||
#elif defined(__amd64__)
|
||||
#define _PR_SI_ARCHITECTURE "amd64"
|
||||
#elif defined(__m68k__)
|
||||
#define _PR_SI_ARCHITECTURE "m68k"
|
||||
#elif defined(__powerpc__)
|
||||
|
@ -92,12 +94,6 @@
|
|||
#define _PR_INET6_PROBE
|
||||
#endif
|
||||
|
||||
#if __NetBSD_Version__ >= 106370000
|
||||
/* NetBSD 1.6ZK */
|
||||
#define _PR_HAVE_GETPROTO_R
|
||||
#define _PR_HAVE_GETPROTO_R_INT
|
||||
#endif
|
||||
|
||||
#define USE_SETJMP
|
||||
|
||||
#ifndef _PR_PTHREADS
|
||||
|
@ -243,6 +239,10 @@ struct _MDCPU {
|
|||
|
||||
#endif /* ! _PR_PTHREADS */
|
||||
|
||||
extern void _MD_EarlyInit(void);
|
||||
extern PRIntervalTime _PR_UNIX_GetInterval(void);
|
||||
extern PRIntervalTime _PR_UNIX_TicksPerSecond(void);
|
||||
|
||||
#define _MD_EARLY_INIT _MD_EarlyInit
|
||||
#define _MD_FINAL_INIT _PR_UnixInit
|
||||
#define _MD_GET_INTERVAL _PR_UNIX_GetInterval
|
||||
|
|
|
@ -63,10 +63,10 @@ PR_BEGIN_EXTERN_C
|
|||
** The format of the version string is
|
||||
** "<major version>.<minor version>[.<patch level>] [<Beta>]"
|
||||
*/
|
||||
#define PR_VERSION "4.7.4 Beta"
|
||||
#define PR_VERSION "4.8 Beta"
|
||||
#define PR_VMAJOR 4
|
||||
#define PR_VMINOR 7
|
||||
#define PR_VPATCH 4
|
||||
#define PR_VMINOR 8
|
||||
#define PR_VPATCH 0
|
||||
#define PR_BETA PR_TRUE
|
||||
|
||||
/*
|
||||
|
|
|
@ -201,6 +201,10 @@ OS_LIBS = advapi32.lib wsock32.lib winmm.lib
|
|||
endif
|
||||
endif
|
||||
|
||||
ifeq ($(OS_TARGET),WINCE)
|
||||
OS_LIBS = ws2.lib
|
||||
endif
|
||||
|
||||
ifeq ($(OS_TARGET),MacOSX)
|
||||
OS_LIBS = -framework CoreServices -framework CoreFoundation
|
||||
endif
|
||||
|
|
|
@ -719,7 +719,7 @@ PR_IMPLEMENT(PRStatus) PR_CreatePipe(
|
|||
#pragma unused (readPipe, writePipe)
|
||||
#endif
|
||||
|
||||
#ifdef WIN32
|
||||
#if defined(WIN32) && !defined(WINCE)
|
||||
HANDLE readEnd, writeEnd;
|
||||
SECURITY_ATTRIBUTES pipeAttributes;
|
||||
|
||||
|
|
|
@ -45,6 +45,18 @@
|
|||
PRLock *_pr_flock_lock;
|
||||
PRCondVar *_pr_flock_cv;
|
||||
|
||||
#ifdef WINCE
|
||||
/*
|
||||
* There are no stdin, stdout, stderr in Windows CE. INVALID_HANDLE_VALUE
|
||||
* should cause all I/O functions on the handle to fail.
|
||||
*/
|
||||
static HANDLE GetStdHandle(DWORD nStdHandle)
|
||||
{
|
||||
SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
|
||||
return INVALID_HANDLE_VALUE;
|
||||
}
|
||||
#endif
|
||||
|
||||
void _PR_InitIO(void)
|
||||
{
|
||||
const PRIOMethods *methods = PR_GetFileMethods();
|
||||
|
|
|
@ -99,6 +99,16 @@ static PRLock *_pr_logLock;
|
|||
#define WIN32_DEBUG_FILE (FILE*)-2
|
||||
#endif
|
||||
|
||||
#ifdef WINCE
|
||||
static void OutputDebugStringA(const char* msg) {
|
||||
int len = MultiByteToWideChar(CP_ACP, 0, msg, -1, 0, 0);
|
||||
WCHAR *wMsg = (WCHAR *)PR_Malloc(len * sizeof(WCHAR));
|
||||
MultiByteToWideChar(CP_ACP, 0, msg, -1, wMsg, len);
|
||||
OutputDebugStringW(wMsg);
|
||||
PR_Free(wMsg);
|
||||
}
|
||||
#endif
|
||||
|
||||
/* Macros used to reduce #ifdef pollution */
|
||||
|
||||
#if defined(_PR_USE_STDIO_FOR_LOGGING) && defined(XP_PC)
|
||||
|
@ -107,7 +117,7 @@ static PRLock *_pr_logLock;
|
|||
if (logFile == WIN32_DEBUG_FILE) { \
|
||||
char savebyte = buf[nb]; \
|
||||
buf[nb] = '\0'; \
|
||||
OutputDebugString(buf); \
|
||||
OutputDebugStringA(buf); \
|
||||
buf[nb] = savebyte; \
|
||||
} else { \
|
||||
fwrite(buf, 1, nb, fd); \
|
||||
|
@ -254,7 +264,7 @@ void _PR_InitLog(void)
|
|||
#ifdef XP_PC
|
||||
char* str = PR_smprintf("Unable to create nspr log file '%s'\n", ev);
|
||||
if (str) {
|
||||
OutputDebugString(str);
|
||||
OutputDebugStringA(str);
|
||||
PR_smprintf_free(str);
|
||||
}
|
||||
#else
|
||||
|
|
|
@ -210,16 +210,6 @@ static char* _pr_currentLibPath = NULL;
|
|||
|
||||
static PRLibrary *pr_LoadLibraryByPathname(const char *name, PRIntn flags);
|
||||
|
||||
#ifdef WIN95
|
||||
typedef HMODULE (WINAPI *LoadLibraryWFn)(LPCWSTR);
|
||||
static HMODULE WINAPI EmulateLoadLibraryW(LPCWSTR);
|
||||
static LoadLibraryWFn loadLibraryW = LoadLibraryW;
|
||||
#endif
|
||||
|
||||
#ifdef WIN32
|
||||
static int pr_ConvertUTF16toUTF8(LPCWSTR wname, LPSTR name, int len);
|
||||
#endif
|
||||
|
||||
/************************************************************************/
|
||||
|
||||
#if !defined(USE_DLFCN) && !defined(HAVE_STRERROR)
|
||||
|
@ -254,12 +244,6 @@ void _PR_InitLinker(void)
|
|||
void *h;
|
||||
#endif
|
||||
|
||||
#ifdef WIN95
|
||||
if (!_pr_useUnicode) {
|
||||
loadLibraryW = EmulateLoadLibraryW;
|
||||
}
|
||||
#endif
|
||||
|
||||
if (!pr_linker_lock) {
|
||||
pr_linker_lock = PR_NewNamedMonitor("linker-lock");
|
||||
}
|
||||
|
@ -780,25 +764,6 @@ pr_LoadViaDyld(const char *name, PRLibrary *lm)
|
|||
|
||||
#endif /* XP_MACOSX && USE_MACH_DYLD */
|
||||
|
||||
#ifdef WIN95
|
||||
static HMODULE WINAPI
|
||||
EmulateLoadLibraryW(LPCWSTR lpLibFileName)
|
||||
{
|
||||
HMODULE h;
|
||||
char nameA[MAX_PATH];
|
||||
|
||||
if (!WideCharToMultiByte(CP_ACP, 0, lpLibFileName, -1,
|
||||
nameA, sizeof nameA, NULL, NULL)) {
|
||||
return NULL;
|
||||
}
|
||||
/* Perhaps it's better to add a check for characters
|
||||
* not representable in CP_ACP.
|
||||
*/
|
||||
h = LoadLibraryA(nameA);
|
||||
return h;
|
||||
}
|
||||
#endif /* WIN95 */
|
||||
|
||||
/*
|
||||
** Dynamically load a library. Only load libraries once, so scan the load
|
||||
** map first.
|
||||
|
@ -838,11 +803,12 @@ pr_LoadLibraryByPathname(const char *name, PRIntn flags)
|
|||
goto unlock;
|
||||
}
|
||||
}
|
||||
len = pr_ConvertUTF16toUTF8(wname, NULL, 0);
|
||||
len = WideCharToMultiByte(CP_UTF8, 0, wname, -1, NULL, 0, NULL, NULL);
|
||||
if (len > MAX_PATH)
|
||||
utf8name = utf8name_malloc = PR_Malloc(len);
|
||||
if (utf8name == NULL ||
|
||||
!pr_ConvertUTF16toUTF8(wname, utf8name, len)) {
|
||||
!WideCharToMultiByte(CP_UTF8, 0, wname, -1,
|
||||
utf8name, len, NULL, NULL)) {
|
||||
oserr = _MD_ERRNO();
|
||||
goto unlock;
|
||||
}
|
||||
|
@ -881,40 +847,22 @@ pr_LoadLibraryByPathname(const char *name, PRIntn flags)
|
|||
}
|
||||
#endif /* XP_OS2 */
|
||||
|
||||
#if defined(WIN32) || defined(WIN16)
|
||||
#ifdef WIN32
|
||||
{
|
||||
HINSTANCE h;
|
||||
|
||||
#ifdef WIN32
|
||||
#ifdef WIN95
|
||||
if (flags & PR_LD_PATHW)
|
||||
h = loadLibraryW(wname);
|
||||
else
|
||||
h = LoadLibraryA(name);
|
||||
#else
|
||||
if (flags & PR_LD_PATHW)
|
||||
h = LoadLibraryW(wname);
|
||||
else
|
||||
h = LoadLibraryA(name);
|
||||
#endif /* WIN95 */
|
||||
#else
|
||||
h = LoadLibrary(name);
|
||||
#endif
|
||||
if (h < (HINSTANCE)HINSTANCE_ERROR) {
|
||||
h = LoadLibraryW(wname);
|
||||
if (h == NULL) {
|
||||
oserr = _MD_ERRNO();
|
||||
PR_DELETE(lm);
|
||||
goto unlock;
|
||||
}
|
||||
#ifdef WIN32
|
||||
lm->name = strdup(utf8name);
|
||||
#else
|
||||
lm->name = strdup(name);
|
||||
#endif
|
||||
lm->dlh = h;
|
||||
lm->next = pr_loadmap;
|
||||
pr_loadmap = lm;
|
||||
}
|
||||
#endif /* WIN32 || WIN16 */
|
||||
#endif /* WIN32 */
|
||||
|
||||
#if defined(XP_MACOSX) && defined(USE_MACH_DYLD)
|
||||
{
|
||||
|
@ -1120,125 +1068,6 @@ pr_LoadLibraryByPathname(const char *name, PRIntn flags)
|
|||
return result;
|
||||
}
|
||||
|
||||
#ifdef WIN32
|
||||
#ifdef WIN95
|
||||
/*
|
||||
* CP_UTF8 is not supported by WideCharToMultiByte on Windows 95 so that
|
||||
* we have to emulate it
|
||||
*/
|
||||
static PRStatus
|
||||
pr_ConvertSingleCharToUTF8(PRUint32 usv, PRUint16 offset, int bufLen,
|
||||
int *utf8Len, char * *buf)
|
||||
{
|
||||
char* p = *buf;
|
||||
PR_ASSERT(!bufLen || *buf);
|
||||
if (!bufLen) {
|
||||
*utf8Len += offset;
|
||||
return PR_SUCCESS;
|
||||
}
|
||||
|
||||
if (*utf8Len + offset >= bufLen)
|
||||
return PR_FAILURE;
|
||||
|
||||
*utf8Len += offset;
|
||||
if (offset == 1) {
|
||||
*p++ = (char) usv;
|
||||
} else if (offset == 2) {
|
||||
*p++ = (char)0xc0 | (usv >> 6);
|
||||
*p++ = (char)0x80 | (usv & 0x003f);
|
||||
} else if (offset == 3) {
|
||||
*p++ = (char)0xe0 | (usv >> 12);
|
||||
*p++ = (char)0x80 | ((usv >> 6) & 0x003f);
|
||||
*p++ = (char)0x80 | (usv & 0x003f);
|
||||
} else { /* offset = 4 */
|
||||
*p++ = (char)0xf0 | (usv >> 18);
|
||||
*p++ = (char)0x80 | ((usv >> 12) & 0x003f);
|
||||
*p++ = (char)0x80 | ((usv >> 6) & 0x003f);
|
||||
*p++ = (char)0x80 | (usv & 0x003f);
|
||||
}
|
||||
|
||||
*buf = p;
|
||||
return PR_SUCCESS;
|
||||
}
|
||||
|
||||
static int pr_ConvertUTF16toUTF8(LPCWSTR wname, LPSTR name, int len)
|
||||
{
|
||||
LPCWSTR pw = wname;
|
||||
LPSTR p = name;
|
||||
int utf8Len = 0;
|
||||
PRBool highSurrogate = PR_FALSE;
|
||||
|
||||
utf8Len = WideCharToMultiByte(CP_UTF8, 0, wname, -1, name, len,
|
||||
NULL, NULL);
|
||||
/*
|
||||
* Windows 95 and NT 3.51 don't support CP_UTF8.
|
||||
* WideCharToMultiByte(CP_UTF8, ...) fails with the error code
|
||||
* ERROR_INVALID_PARAMETER on Windows 95 and NT 3.51.
|
||||
*/
|
||||
if (utf8Len || GetLastError() != ERROR_INVALID_PARAMETER)
|
||||
return utf8Len;
|
||||
|
||||
if (!wname || len < 0 || (len > 0 && !name)) {
|
||||
SetLastError(ERROR_INVALID_PARAMETER);
|
||||
return 0;
|
||||
}
|
||||
|
||||
while (*pw) {
|
||||
PRStatus status = PR_SUCCESS;
|
||||
if (highSurrogate) {
|
||||
if (*pw >= (PRUnichar) 0xDC00 && *pw < (PRUnichar) 0xE000) {
|
||||
/* found a matching low surrogate */
|
||||
/* convert a surrogate pair to UCS4 */
|
||||
PRUint32 usv = ((*(pw-1) - (PRUnichar)0xD800) << 10) +
|
||||
(*pw - (PRUnichar)0xDC00) + (PRUint32)0x10000;
|
||||
if (pr_ConvertSingleCharToUTF8(usv, 4, len, &utf8Len, &p) ==
|
||||
PR_FAILURE)
|
||||
return 0;
|
||||
highSurrogate = PR_FALSE;
|
||||
++pw;
|
||||
continue;
|
||||
} else {
|
||||
/*
|
||||
* silently ignore a lone high surrogate
|
||||
* as is done by WideCharToMultiByte by default
|
||||
*/
|
||||
highSurrogate = PR_FALSE;
|
||||
}
|
||||
}
|
||||
if (*pw <= 0x7f)
|
||||
status = pr_ConvertSingleCharToUTF8(*pw, 1, len, &utf8Len, &p);
|
||||
else if (*pw <= 0x07ff)
|
||||
status = pr_ConvertSingleCharToUTF8(*pw, 2, len, &utf8Len, &p);
|
||||
else if (*pw < (PRUnichar) 0xD800 || *pw >= (PRUnichar) 0xE000)
|
||||
status = pr_ConvertSingleCharToUTF8(*pw, 3, len, &utf8Len, &p);
|
||||
else if (*pw < (PRUnichar) 0xDC00)
|
||||
highSurrogate = PR_TRUE;
|
||||
/* else */
|
||||
/* silently ignore a lone low surrogate as is done by
|
||||
* WideCharToMultiByte by default */
|
||||
|
||||
if (status == PR_FAILURE) {
|
||||
SetLastError(ERROR_INSUFFICIENT_BUFFER);
|
||||
return 0;
|
||||
}
|
||||
++pw;
|
||||
}
|
||||
|
||||
/* if we're concerned with a lone high surrogate,
|
||||
* we have to take care of it here, but we just drop it
|
||||
*/
|
||||
if (len > 0)
|
||||
*p = '\0';
|
||||
return utf8Len + 1;
|
||||
}
|
||||
#else
|
||||
static int pr_ConvertUTF16toUTF8(LPCWSTR wname, LPSTR name, int len)
|
||||
{
|
||||
return WideCharToMultiByte(CP_UTF8, 0, wname, -1, name, len, NULL, NULL);
|
||||
}
|
||||
#endif /* WIN95 */
|
||||
#endif /* WIN32 */
|
||||
|
||||
/*
|
||||
** Unload a shared library which was loaded via PR_LoadLibrary
|
||||
*/
|
||||
|
@ -1923,24 +1752,35 @@ PR_GetLibraryFilePathname(const char *name, PRFuncPtr addr)
|
|||
}
|
||||
return result;
|
||||
#elif defined(WIN32)
|
||||
HMODULE handle;
|
||||
char module_name[MAX_PATH];
|
||||
PRUnichar wname[MAX_PATH];
|
||||
HMODULE handle = NULL;
|
||||
PRUnichar module_name[MAX_PATH];
|
||||
int len;
|
||||
char *result;
|
||||
|
||||
handle = GetModuleHandle(name);
|
||||
if (MultiByteToWideChar(CP_ACP, 0, name, -1, wname, MAX_PATH)) {
|
||||
handle = GetModuleHandleW(wname);
|
||||
}
|
||||
if (handle == NULL) {
|
||||
PR_SetError(PR_LIBRARY_NOT_LOADED_ERROR, _MD_ERRNO());
|
||||
DLLErrorInternal(_MD_ERRNO());
|
||||
return NULL;
|
||||
}
|
||||
if (GetModuleFileName(handle, module_name, sizeof module_name) == 0) {
|
||||
if (GetModuleFileNameW(handle, module_name, MAX_PATH) == 0) {
|
||||
/* should not happen */
|
||||
_PR_MD_MAP_DEFAULT_ERROR(_MD_ERRNO());
|
||||
return NULL;
|
||||
}
|
||||
result = PR_Malloc(strlen(module_name)+1);
|
||||
len = WideCharToMultiByte(CP_ACP, 0, module_name, -1,
|
||||
NULL, 0, NULL, NULL);
|
||||
if (len == 0) {
|
||||
_PR_MD_MAP_DEFAULT_ERROR(_MD_ERRNO());
|
||||
return NULL;
|
||||
}
|
||||
result = PR_Malloc(len * sizeof(PRUnichar));
|
||||
if (result != NULL) {
|
||||
strcpy(result, module_name);
|
||||
WideCharToMultiByte(CP_ACP, 0, module_name, -1,
|
||||
result, len, NULL, NULL);
|
||||
}
|
||||
return result;
|
||||
#elif defined(XP_OS2)
|
||||
|
|
|
@ -62,7 +62,7 @@ CSRCS = \
|
|||
ntinrval.c \
|
||||
$(NULL)
|
||||
else
|
||||
ifeq ($(OS_TARGET), WIN95)
|
||||
ifeq (,$(filter-out WIN95 WINCE, $(OS_TARGET)))
|
||||
CSRCS = \
|
||||
ntmisc.c \
|
||||
ntsec.c \
|
||||
|
|
|
@ -69,6 +69,9 @@ static struct {
|
|||
*/
|
||||
void _PR_NT_InitSids(void)
|
||||
{
|
||||
#ifdef WINCE /* not supported */
|
||||
return;
|
||||
#else
|
||||
SID_IDENTIFIER_AUTHORITY SIDAuthWorld = SECURITY_WORLD_SID_AUTHORITY;
|
||||
HANDLE hToken = NULL; /* initialized to an arbitrary value to
|
||||
* silence a Purify UMR warning */
|
||||
|
@ -128,6 +131,7 @@ void _PR_NT_InitSids(void)
|
|||
0, 0, 0, 0, 0, 0, 0,
|
||||
&_pr_nt_sids.everyone);
|
||||
PR_ASSERT(rv != 0);
|
||||
#endif
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -139,6 +143,9 @@ void _PR_NT_InitSids(void)
|
|||
void
|
||||
_PR_NT_FreeSids(void)
|
||||
{
|
||||
#ifdef WINCE
|
||||
return;
|
||||
#else
|
||||
if (_pr_nt_sids.owner) {
|
||||
PR_Free(_pr_nt_sids.owner);
|
||||
}
|
||||
|
@ -148,6 +155,7 @@ _PR_NT_FreeSids(void)
|
|||
if (_pr_nt_sids.everyone) {
|
||||
FreeSid(_pr_nt_sids.everyone);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -168,6 +176,10 @@ _PR_NT_MakeSecurityDescriptorACL(
|
|||
PSECURITY_DESCRIPTOR *resultSD,
|
||||
PACL *resultACL)
|
||||
{
|
||||
#ifdef WINCE
|
||||
PR_SetError(PR_NOT_IMPLEMENTED_ERROR, 0);
|
||||
return PR_FAILURE;
|
||||
#else
|
||||
PSECURITY_DESCRIPTOR pSD = NULL;
|
||||
PACL pACL = NULL;
|
||||
DWORD cbACL; /* size of ACL */
|
||||
|
@ -261,6 +273,7 @@ failed:
|
|||
PR_Free(pACL);
|
||||
}
|
||||
return PR_FAILURE;
|
||||
#endif
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
|
@ -51,7 +51,7 @@ CSRCS = ntmisc.c \
|
|||
w32rng.c \
|
||||
w32shm.c
|
||||
else
|
||||
ifeq ($(OS_TARGET),WIN95)
|
||||
ifeq (,$(filter-out WIN95 WINCE, $(OS_TARGET)))
|
||||
CSRCS = ntmisc.c \
|
||||
ntsec.c \
|
||||
ntsem.c \
|
||||
|
|
|
@ -42,6 +42,30 @@
|
|||
|
||||
#include "primpl.h"
|
||||
|
||||
#ifdef WINCE
|
||||
static HANDLE OpenSemaphore(DWORD inDesiredAccess,
|
||||
BOOL inInheritHandle,
|
||||
const char *inName)
|
||||
{
|
||||
HANDLE retval = NULL;
|
||||
HANDLE semaphore = NULL;
|
||||
PRUnichar wideName[MAX_PATH]; /* name size is limited to MAX_PATH */
|
||||
|
||||
MultiByteToWideChar(CP_ACP, 0, inName, -1, wideName, MAX_PATH);
|
||||
/* 0x7fffffff is the max count for our semaphore */
|
||||
semaphore = CreateSemaphoreW(NULL, 0, 0x7fffffff, wideName);
|
||||
if (NULL != semaphore) {
|
||||
DWORD lastErr = GetLastError();
|
||||
|
||||
if (ERROR_ALREADY_EXISTS != lastErr)
|
||||
CloseHandle(semaphore);
|
||||
else
|
||||
retval = semaphore;
|
||||
}
|
||||
return retval;
|
||||
}
|
||||
#endif
|
||||
|
||||
/*
|
||||
* NSPR-to-NT access right mapping table for semaphore objects.
|
||||
*
|
||||
|
@ -147,7 +171,16 @@ PRSem *_PR_MD_OPEN_SEMAPHORE(
|
|||
sa.bInheritHandle = FALSE;
|
||||
lpSA = &sa;
|
||||
}
|
||||
sem->sem = CreateSemaphore(lpSA, value, 0x7fffffff, osname);
|
||||
#ifdef WINCE
|
||||
{
|
||||
/* The size of a sem's name is limited to MAX_PATH. */
|
||||
PRUnichar wosname[MAX_PATH];
|
||||
MultiByteToWideChar(CP_ACP, 0, osname, -1, wosname, MAX_PATH);
|
||||
sem->sem = CreateSemaphoreW(lpSA, value, 0x7fffffff, wosname);
|
||||
}
|
||||
#else
|
||||
sem->sem = CreateSemaphoreA(lpSA, value, 0x7fffffff, osname);
|
||||
#endif
|
||||
if (lpSA != NULL) {
|
||||
_PR_NT_FreeSecurityDescriptorACL(pSD, pACL);
|
||||
}
|
||||
|
|
|
@ -119,13 +119,32 @@ extern PRSharedMemory * _MD_OpenSharedMemory(
|
|||
sa.bInheritHandle = FALSE;
|
||||
lpSA = &sa;
|
||||
}
|
||||
shm->handle = CreateFileMapping(
|
||||
#ifdef WINCE
|
||||
{
|
||||
/*
|
||||
* This is assuming that the name will never be larger than
|
||||
* MAX_PATH. Should we dynamically allocate?
|
||||
*/
|
||||
PRUnichar wideIpcName[MAX_PATH];
|
||||
MultiByteToWideChar(CP_ACP, 0, shm->ipcname, -1,
|
||||
wideIpcName, MAX_PATH);
|
||||
shm->handle = CreateFileMappingW(
|
||||
(HANDLE)-1 ,
|
||||
lpSA,
|
||||
flProtect,
|
||||
dwHi,
|
||||
dwLo,
|
||||
wideIpcName);
|
||||
}
|
||||
#else
|
||||
shm->handle = CreateFileMappingA(
|
||||
(HANDLE)-1 ,
|
||||
lpSA,
|
||||
flProtect,
|
||||
dwHi,
|
||||
dwLo,
|
||||
shm->ipcname);
|
||||
#endif
|
||||
if (lpSA != NULL) {
|
||||
_PR_NT_FreeSecurityDescriptorACL(pSD, pACL);
|
||||
}
|
||||
|
@ -156,7 +175,12 @@ extern PRSharedMemory * _MD_OpenSharedMemory(
|
|||
}
|
||||
}
|
||||
} else {
|
||||
#ifdef WINCE
|
||||
PR_SetError( PR_NOT_IMPLEMENTED_ERROR, 0 );
|
||||
shm->handle = NULL; /* OpenFileMapping not supported */
|
||||
#else
|
||||
shm->handle = OpenFileMapping( FILE_MAP_WRITE, TRUE, shm->ipcname );
|
||||
#endif
|
||||
if ( NULL == shm->handle ) {
|
||||
_PR_MD_MAP_DEFAULT_ERROR( GetLastError());
|
||||
PR_LOG(_pr_shm_lm, PR_LOG_DEBUG,
|
||||
|
|
|
@ -119,7 +119,7 @@ void _PR_MD_InitSockets(void)
|
|||
/* if Vista or later... */
|
||||
if (osvi.dwMajorVersion >= 6)
|
||||
{
|
||||
libWinsock2 = LoadLibrary("Ws2_32.dll");
|
||||
libWinsock2 = LoadLibraryW(L"Ws2_32.dll");
|
||||
if (libWinsock2)
|
||||
{
|
||||
wsaioctlProc = (WSAIOCTLPROC)GetProcAddress(libWinsock2,
|
||||
|
|
|
@ -234,15 +234,24 @@ _PR_MD_EXIT(PRIntn status)
|
|||
|
||||
PRInt32 _PR_MD_SETTHREADAFFINITYMASK(PRThread *thread, PRUint32 mask )
|
||||
{
|
||||
#ifdef WINCE
|
||||
SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
|
||||
return -1;
|
||||
#else
|
||||
DWORD_PTR rv;
|
||||
|
||||
rv = SetThreadAffinityMask(thread->md.handle, mask);
|
||||
|
||||
return rv?0:-1;
|
||||
#endif
|
||||
}
|
||||
|
||||
PRInt32 _PR_MD_GETTHREADAFFINITYMASK(PRThread *thread, PRUint32 *mask)
|
||||
{
|
||||
#ifdef WINCE
|
||||
SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
|
||||
return -1;
|
||||
#else
|
||||
BOOL rv;
|
||||
DWORD_PTR process_mask;
|
||||
DWORD_PTR system_mask;
|
||||
|
@ -253,6 +262,7 @@ PRInt32 _PR_MD_GETTHREADAFFINITYMASK(PRThread *thread, PRUint32 *mask)
|
|||
*mask = (PRUint32)process_mask;
|
||||
|
||||
return rv?0:-1;
|
||||
#endif
|
||||
}
|
||||
|
||||
void
|
||||
|
|
|
@ -313,7 +313,7 @@ PR_IMPLEMENT(PRUint64) PR_GetPhysicalMemorySize(void)
|
|||
|
||||
/* Try to use the newer GlobalMemoryStatusEx API for Windows 2000+. */
|
||||
GlobalMemoryStatusExFn globalMemory = (GlobalMemoryStatusExFn) NULL;
|
||||
HMODULE module = GetModuleHandle("kernel32.dll");
|
||||
HMODULE module = GetModuleHandleW(L"kernel32.dll");
|
||||
|
||||
if (module) {
|
||||
globalMemory = (GlobalMemoryStatusExFn)GetProcAddress(module, "GlobalMemoryStatusEx");
|
||||
|
|
|
@ -52,10 +52,10 @@
|
|||
#include <stdlib.h>
|
||||
|
||||
/*
|
||||
* This release (4.7.4) is backward compatible with the
|
||||
* 4.0.x, 4.1.x, 4.2.x, 4.3.x, 4.4.x, 4.5.x, 4.6.x, 4.7,
|
||||
* 4.7.1, 4.7.2, and 4.7.3 releases. It, of course, is
|
||||
* compatible with itself.
|
||||
* This release (4.8) is backward compatible with the
|
||||
* 4.0.x, 4.1.x, 4.2.x, 4.3.x, 4.4.x, 4.5.x, 4.6.x, and
|
||||
* 4.7.x releases. It, of course, is compatible with
|
||||
* itself.
|
||||
*/
|
||||
static char *compatible_version[] = {
|
||||
"4.0", "4.0.1", "4.1", "4.1.1", "4.1.2", "4.1.3",
|
||||
|
@ -78,8 +78,8 @@ static char *incompatible_version[] = {
|
|||
"3.0", "3.0.1",
|
||||
"3.1", "3.1.1", "3.1.2", "3.1.3",
|
||||
"3.5", "3.5.1",
|
||||
"4.7.9",
|
||||
"4.8", "4.8.1",
|
||||
"4.8.9",
|
||||
"4.9", "4.9.1",
|
||||
"10.0", "11.1", "12.14.20"
|
||||
};
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче