mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 456449: Upgraded NSPR to NSPR_HEAD_20090207.
This commit is contained in:
parent
c53bb7ec3a
commit
fe0c3f7f83
@ -401,19 +401,20 @@ endif
|
||||
|
||||
ifdef NEED_ABSOLUTE_PATH
|
||||
PWD := $(shell pwd)
|
||||
abspath = $(if $(findstring :,$(1)),$(1),$(if $(filter /%,$(1)),$(1),$(PWD)/$(1)))
|
||||
# The quotes allow absolute paths to contain spaces.
|
||||
pr_abspath = "$(if $(findstring :,$(1)),$(1),$(if $(filter /%,$(1)),$(1),$(PWD)/$(1)))"
|
||||
endif
|
||||
|
||||
$(OBJDIR)/%.$(OBJ_SUFFIX): %.cpp
|
||||
@$(MAKE_OBJDIR)
|
||||
ifeq ($(NS_USE_GCC)_$(OS_ARCH),_WINNT)
|
||||
$(CCC) -Fo$@ -c $(CCCFLAGS) $(call abspath,$<)
|
||||
$(CCC) -Fo$@ -c $(CCCFLAGS) $(call pr_abspath,$<)
|
||||
else
|
||||
ifeq ($(NS_USE_GCC)_$(OS_ARCH),_WINCE)
|
||||
$(CCC) -Fo$@ -c $(CCCFLAGS) $<
|
||||
else
|
||||
ifdef NEED_ABSOLUTE_PATH
|
||||
$(CCC) -o $@ -c $(CCCFLAGS) $(call abspath,$<)
|
||||
$(CCC) -o $@ -c $(CCCFLAGS) $(call pr_abspath,$<)
|
||||
else
|
||||
$(CCC) -o $@ -c $(CCCFLAGS) $<
|
||||
endif
|
||||
@ -426,13 +427,13 @@ WCCFLAGS3 = $(subst -D,-d,$(WCCFLAGS2))
|
||||
$(OBJDIR)/%.$(OBJ_SUFFIX): %.c
|
||||
@$(MAKE_OBJDIR)
|
||||
ifeq ($(NS_USE_GCC)_$(OS_ARCH),_WINNT)
|
||||
$(CC) -Fo$@ -c $(CFLAGS) $(call abspath,$<)
|
||||
$(CC) -Fo$@ -c $(CFLAGS) $(call pr_abspath,$<)
|
||||
else
|
||||
ifeq ($(NS_USE_GCC)_$(OS_ARCH),_WINCE)
|
||||
$(CC) -Fo$@ -c $(CFLAGS) $<
|
||||
else
|
||||
ifdef NEED_ABSOLUTE_PATH
|
||||
$(CC) -o $@ -c $(CFLAGS) $(call abspath,$<)
|
||||
$(CC) -o $@ -c $(CFLAGS) $(call pr_abspath,$<)
|
||||
else
|
||||
$(CC) -o $@ -c $(CFLAGS) $<
|
||||
endif
|
||||
|
@ -160,7 +160,7 @@ struct _MDSegment {
|
||||
|
||||
struct _MDDir {
|
||||
HANDLE d_hdl;
|
||||
WIN32_FIND_DATA d_entry;
|
||||
WIN32_FIND_DATAA d_entry;
|
||||
PRBool firstEntry; /* Is this the entry returned
|
||||
* by FindFirstFile()? */
|
||||
PRUint32 magic; /* for debugging */
|
||||
|
@ -51,6 +51,121 @@
|
||||
|
||||
#ifdef WINCE
|
||||
|
||||
static HANDLE CreateFileA(LPCSTR lpFileName,
|
||||
DWORD dwDesiredAccess,
|
||||
DWORD dwShareMode,
|
||||
LPSECURITY_ATTRIBUTES lpSecurityAttributes,
|
||||
DWORD dwCreationDisposition,
|
||||
DWORD dwFlagsAndAttributes,
|
||||
HANDLE hTemplateFile)
|
||||
{
|
||||
PRUnichar wFileName[MAX_PATH];
|
||||
MultiByteToWideChar(CP_ACP, 0, lpFileName, -1, wFileName, MAX_PATH);
|
||||
return CreateFileW(wFileName, dwDesiredAccess, dwShareMode,
|
||||
lpSecurityAttributes, dwCreationDisposition,
|
||||
dwFlagsAndAttributes, hTemplateFile);
|
||||
}
|
||||
|
||||
/*
|
||||
* We seem to call FindFirstFileA and FindNextFileA just to
|
||||
* get the file names in a directory listing. If so, the
|
||||
* WIN32_FIND_DATAA structure could be defined to contain
|
||||
* just the cFileName field, and the CopyFindFileDataW2A
|
||||
* function could just copy/convert the cFileName field.
|
||||
*/
|
||||
typedef struct _WIN32_FIND_DATAA {
|
||||
DWORD dwFileAttributes;
|
||||
FILETIME ftCreationTime;
|
||||
FILETIME ftLastAccessTime;
|
||||
FILETIME ftLastWriteTime;
|
||||
DWORD nFileSizeHigh;
|
||||
DWORD nFileSizeLow;
|
||||
DWORD dwOID;
|
||||
CHAR cFileName[MAX_PATH];
|
||||
} WIN32_FIND_DATAA, *LPWIN32_FIND_DATAA;
|
||||
|
||||
static void CopyFindFileDataW2A(LPWIN32_FIND_DATAW from,
|
||||
LPWIN32_FIND_DATAA to)
|
||||
{
|
||||
to->dwFileAttributes = from->dwFileAttributes;
|
||||
to->ftCreationTime = from->ftCreationTime;
|
||||
to->ftLastAccessTime = from->ftLastAccessTime;
|
||||
to->ftLastWriteTime = from->ftLastWriteTime;
|
||||
to->nFileSizeHigh = from->nFileSizeHigh;
|
||||
to->nFileSizeLow = from->nFileSizeLow;
|
||||
to->dwOID = from->dwOID;
|
||||
WideCharToMultiByte(CP_ACP, 0, from->cFileName, -1,
|
||||
to->cFileName, MAX_PATH, NULL, NULL);
|
||||
}
|
||||
|
||||
static HANDLE FindFirstFileA(LPCSTR lpFileName,
|
||||
LPWIN32_FIND_DATAA lpFindFileData)
|
||||
{
|
||||
PRUnichar wFileName[MAX_PATH];
|
||||
HANDLE hFindFile;
|
||||
WIN32_FIND_DATAW wFindFileData;
|
||||
|
||||
MultiByteToWideChar(CP_ACP, 0, lpFileName, -1, wFileName, MAX_PATH);
|
||||
hFindFile = FindFirstFileW(wFileName, &wFindFileData);
|
||||
if (hFindFile != INVALID_HANDLE_VALUE) {
|
||||
CopyFindFileDataW2A(&wFindFileData, lpFindFileData);
|
||||
}
|
||||
return hFindFile;
|
||||
}
|
||||
|
||||
static BOOL FindNextFileA(HANDLE hFindFile,
|
||||
LPWIN32_FIND_DATAA lpFindFileData)
|
||||
{
|
||||
WIN32_FIND_DATAW wFindFileData;
|
||||
BOOL rv;
|
||||
|
||||
rv = FindNextFileW(hFindFile, &wFindFileData);
|
||||
if (rv) {
|
||||
CopyFindFileDataW2A(&wFindFileData, lpFindFileData);
|
||||
}
|
||||
return rv;
|
||||
}
|
||||
|
||||
static BOOL GetFileAttributesExA(LPCSTR lpFileName,
|
||||
GET_FILEEX_INFO_LEVELS fInfoLevelId,
|
||||
LPVOID lpFileInformation)
|
||||
{
|
||||
PRUnichar wFileName[MAX_PATH];
|
||||
MultiByteToWideChar(CP_ACP, 0, lpFileName, -1, wFileName, MAX_PATH);
|
||||
return GetFileAttributesExW(wFileName, fInfoLevelId, lpFileInformation);
|
||||
}
|
||||
|
||||
static BOOL DeleteFileA(LPCSTR lpFileName)
|
||||
{
|
||||
PRUnichar wFileName[MAX_PATH];
|
||||
MultiByteToWideChar(CP_ACP, 0, lpFileName, -1, wFileName, MAX_PATH);
|
||||
return DeleteFileW(wFileName);
|
||||
}
|
||||
|
||||
static BOOL MoveFileA(LPCSTR from, LPCSTR to)
|
||||
{
|
||||
PRUnichar wFrom[MAX_PATH];
|
||||
PRUnichar wTo[MAX_PATH];
|
||||
MultiByteToWideChar(CP_ACP, 0, from, -1, wFrom, MAX_PATH);
|
||||
MultiByteToWideChar(CP_ACP, 0, to, -1, wTo, MAX_PATH);
|
||||
return MoveFileW(wFrom, wTo);
|
||||
}
|
||||
|
||||
static BOOL CreateDirectoryA(LPCSTR lpPathName,
|
||||
LPSECURITY_ATTRIBUTES lpSecurityAttributes)
|
||||
{
|
||||
PRUnichar wPathName[MAX_PATH];
|
||||
MultiByteToWideChar(CP_ACP, 0, lpPathName, -1, wPathName, MAX_PATH);
|
||||
return CreateDirectoryW(wPathName, lpSecurityAttributes);
|
||||
}
|
||||
|
||||
static BOOL RemoveDirectoryA(LPCSTR lpPathName)
|
||||
{
|
||||
PRUnichar wPathName[MAX_PATH];
|
||||
MultiByteToWideChar(CP_ACP, 0, lpPathName, -1, wPathName, MAX_PATH);
|
||||
return RemoveDirectoryW(wPathName);
|
||||
}
|
||||
|
||||
static long GetDriveType(const char *lpRootPathName)
|
||||
{
|
||||
PR_SetError(PR_NOT_IMPLEMENTED_ERROR, 0);
|
||||
@ -126,22 +241,6 @@ static unsigned char *_mbsinc(const unsigned char *inCurrent)
|
||||
return (unsigned char *)(inCurrent + 1);
|
||||
}
|
||||
|
||||
static unsigned char *_mbspbrk(const unsigned char *inString,
|
||||
const unsigned char *inStrCharSet)
|
||||
{
|
||||
// needs work dft
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static const unsigned short *_wcsdec(const unsigned short *s,
|
||||
const unsigned short *p)
|
||||
{
|
||||
// needs work dft
|
||||
|
||||
p = s < p ? (const unsigned short *)(s - 1) : 0;
|
||||
return p;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
struct _MDLock _pr_ioq_lock;
|
||||
@ -175,16 +274,18 @@ static const PRTime _pr_filetime_offset = 116444736000000000LL;
|
||||
static const PRTime _pr_filetime_offset = 116444736000000000i64;
|
||||
#endif
|
||||
|
||||
/* Windows CE has GetFileAttributesEx. */
|
||||
#ifndef WINCE
|
||||
typedef BOOL (WINAPI *GetFileAttributesExFn)(LPCTSTR,
|
||||
GET_FILEEX_INFO_LEVELS,
|
||||
LPVOID);
|
||||
static GetFileAttributesExFn getFileAttributesEx;
|
||||
static void InitGetFileInfo(void);
|
||||
#endif
|
||||
|
||||
static void InitUnicodeSupport(void);
|
||||
|
||||
static PRBool IsPrevCharSlash(const char *str, const char *current);
|
||||
static PRBool IsPrevCharSlashW(const PRUnichar *str, const PRUnichar *current);
|
||||
|
||||
void
|
||||
_PR_MD_INIT_IO()
|
||||
@ -223,7 +324,9 @@ _PR_MD_INIT_IO()
|
||||
|
||||
_PR_NT_InitSids();
|
||||
|
||||
#ifndef WINCE
|
||||
InitGetFileInfo();
|
||||
#endif
|
||||
|
||||
InitUnicodeSupport();
|
||||
|
||||
@ -322,13 +425,13 @@ _PR_MD_OPEN(const char *name, PRIntn osflags, int mode)
|
||||
flags = OPEN_EXISTING;
|
||||
}
|
||||
|
||||
file = CreateFile(name,
|
||||
access,
|
||||
FILE_SHARE_READ|FILE_SHARE_WRITE,
|
||||
NULL,
|
||||
flags,
|
||||
flag6,
|
||||
NULL);
|
||||
file = CreateFileA(name,
|
||||
access,
|
||||
FILE_SHARE_READ|FILE_SHARE_WRITE,
|
||||
NULL,
|
||||
flags,
|
||||
flag6,
|
||||
NULL);
|
||||
if (file == INVALID_HANDLE_VALUE) {
|
||||
_PR_MD_MAP_OPEN_ERROR(GetLastError());
|
||||
return -1;
|
||||
@ -380,13 +483,13 @@ _PR_MD_OPEN_FILE(const char *name, PRIntn osflags, int mode)
|
||||
flags = OPEN_EXISTING;
|
||||
}
|
||||
|
||||
file = CreateFile(name,
|
||||
access,
|
||||
FILE_SHARE_READ|FILE_SHARE_WRITE,
|
||||
lpSA,
|
||||
flags,
|
||||
flag6,
|
||||
NULL);
|
||||
file = CreateFileA(name,
|
||||
access,
|
||||
FILE_SHARE_READ|FILE_SHARE_WRITE,
|
||||
lpSA,
|
||||
flags,
|
||||
flag6,
|
||||
NULL);
|
||||
if (lpSA != NULL) {
|
||||
_PR_NT_FreeSecurityDescriptorACL(pSD, pACL);
|
||||
}
|
||||
@ -566,7 +669,7 @@ _MD_CloseFile(PROsfd osfd)
|
||||
#define GetFileFromDIR(d) (d)->d_entry.cFileName
|
||||
#define FileIsHidden(d) ((d)->d_entry.dwFileAttributes & FILE_ATTRIBUTE_HIDDEN)
|
||||
|
||||
void FlipSlashes(char *cp, size_t len)
|
||||
static void FlipSlashes(char *cp, size_t len)
|
||||
{
|
||||
while (len-- > 0) {
|
||||
if (cp[0] == '/') {
|
||||
@ -576,16 +679,6 @@ void FlipSlashes(char *cp, size_t len)
|
||||
}
|
||||
} /* end FlipSlashes() */
|
||||
|
||||
void FlipSlashesW(PRUnichar *cp, size_t len)
|
||||
{
|
||||
while (len-- > 0) {
|
||||
if (cp[0] == L'/') {
|
||||
cp[0] = L'\\';
|
||||
}
|
||||
cp++;
|
||||
}
|
||||
} /* end FlipSlashesW() */
|
||||
|
||||
|
||||
/*
|
||||
**
|
||||
@ -635,7 +728,7 @@ _PR_MD_OPEN_DIR(_MDDir *d, const char *name)
|
||||
strcpy(&filename[len], "\\*.*");
|
||||
FlipSlashes( filename, strlen(filename) );
|
||||
|
||||
d->d_hdl = FindFirstFile( filename, &(d->d_entry) );
|
||||
d->d_hdl = FindFirstFileA( filename, &(d->d_entry) );
|
||||
if ( d->d_hdl == INVALID_HANDLE_VALUE ) {
|
||||
_PR_MD_MAP_OPENDIR_ERROR(GetLastError());
|
||||
return PR_FAILURE;
|
||||
@ -658,7 +751,7 @@ _PR_MD_READ_DIR(_MDDir *d, PRIntn flags)
|
||||
d->firstEntry = PR_FALSE;
|
||||
rv = 1;
|
||||
} else {
|
||||
rv = FindNextFile(d->d_hdl, &(d->d_entry));
|
||||
rv = FindNextFileA(d->d_hdl, &(d->d_entry));
|
||||
}
|
||||
if (rv == 0) {
|
||||
break;
|
||||
@ -687,7 +780,7 @@ _PR_MD_READ_DIR(_MDDir *d, PRIntn flags)
|
||||
PRInt32
|
||||
_PR_MD_DELETE(const char *name)
|
||||
{
|
||||
if (DeleteFile(name)) {
|
||||
if (DeleteFileA(name)) {
|
||||
return 0;
|
||||
} else {
|
||||
_PR_MD_MAP_DELETE_ERROR(GetLastError());
|
||||
@ -801,17 +894,6 @@ IsPrevCharSlash(const char *str, const char *current)
|
||||
return (prev == current - 1) && _PR_IS_SLASH(*prev);
|
||||
}
|
||||
|
||||
static PRBool
|
||||
IsPrevCharSlashW(const PRUnichar *str, const PRUnichar *current)
|
||||
{
|
||||
const PRUnichar *prev;
|
||||
|
||||
if (str >= current)
|
||||
return PR_FALSE;
|
||||
prev = _wcsdec(str, current);
|
||||
return (prev == current - 1) && _PR_IS_SLASH(*prev);
|
||||
}
|
||||
|
||||
/*
|
||||
* IsRootDirectory --
|
||||
*
|
||||
@ -900,6 +982,7 @@ IsRootDirectory(char *fn, size_t buflen)
|
||||
return rv;
|
||||
}
|
||||
|
||||
#ifndef WINCE
|
||||
/*
|
||||
* InitGetFileInfo --
|
||||
*
|
||||
@ -911,7 +994,7 @@ IsRootDirectory(char *fn, size_t buflen)
|
||||
static void InitGetFileInfo(void)
|
||||
{
|
||||
HMODULE module;
|
||||
module = GetModuleHandleW(L"Kernel32.dll");
|
||||
module = GetModuleHandle("Kernel32.dll");
|
||||
if (!module) {
|
||||
PR_LOG(_pr_io_lm, PR_LOG_DEBUG,
|
||||
("InitGetFileInfo: GetModuleHandle() failed: %d",
|
||||
@ -923,7 +1006,6 @@ static void InitGetFileInfo(void)
|
||||
GetProcAddress(module, "GetFileAttributesExA");
|
||||
}
|
||||
|
||||
#ifndef WINCE
|
||||
/*
|
||||
* If GetFileAttributeEx doesn't exist, we call FindFirstFile as a
|
||||
* fallback.
|
||||
@ -1006,7 +1088,11 @@ GetFileAttributesExFB(const char *fn, WIN32_FIND_DATA *findFileData)
|
||||
PRInt32
|
||||
_PR_MD_GETFILEINFO64(const char *fn, PRFileInfo64 *info)
|
||||
{
|
||||
#ifdef WINCE
|
||||
WIN32_FILE_ATTRIBUTE_DATA findFileData;
|
||||
#else
|
||||
WIN32_FIND_DATA findFileData;
|
||||
#endif
|
||||
BOOL rv;
|
||||
|
||||
if (NULL == fn || '\0' == *fn) {
|
||||
@ -1014,12 +1100,16 @@ _PR_MD_GETFILEINFO64(const char *fn, PRFileInfo64 *info)
|
||||
return -1;
|
||||
}
|
||||
|
||||
#ifdef WINCE
|
||||
rv = GetFileAttributesExA(fn, GetFileExInfoStandard, &findFileData);
|
||||
#else
|
||||
/* GetFileAttributesEx is supported on Win 2K and up. */
|
||||
if (getFileAttributesEx) {
|
||||
rv = getFileAttributesEx(fn, GetFileExInfoStandard, &findFileData);
|
||||
} else {
|
||||
rv = GetFileAttributesExFB(fn, &findFileData);
|
||||
}
|
||||
#endif
|
||||
if (!rv) {
|
||||
_PR_MD_MAP_OPENDIR_ERROR(GetLastError());
|
||||
return -1;
|
||||
@ -1162,7 +1252,7 @@ PRInt32
|
||||
_PR_MD_RENAME(const char *from, const char *to)
|
||||
{
|
||||
/* Does this work with dot-relative pathnames? */
|
||||
if (MoveFile(from, to)) {
|
||||
if (MoveFileA(from, to)) {
|
||||
return 0;
|
||||
} else {
|
||||
_PR_MD_MAP_RENAME_ERROR(GetLastError());
|
||||
@ -1202,7 +1292,7 @@ PRInt32
|
||||
_PR_MD_MKDIR(const char *name, PRIntn mode)
|
||||
{
|
||||
/* XXXMB - how to translate the "mode"??? */
|
||||
if (CreateDirectory(name, NULL)) {
|
||||
if (CreateDirectoryA(name, NULL)) {
|
||||
return 0;
|
||||
} else {
|
||||
_PR_MD_MAP_MKDIR_ERROR(GetLastError());
|
||||
@ -1226,7 +1316,7 @@ _PR_MD_MAKE_DIR(const char *name, PRIntn mode)
|
||||
sa.bInheritHandle = FALSE;
|
||||
lpSA = &sa;
|
||||
}
|
||||
rv = CreateDirectory(name, lpSA);
|
||||
rv = CreateDirectoryA(name, lpSA);
|
||||
if (lpSA != NULL) {
|
||||
_PR_NT_FreeSecurityDescriptorACL(pSD, pACL);
|
||||
}
|
||||
@ -1241,7 +1331,7 @@ _PR_MD_MAKE_DIR(const char *name, PRIntn mode)
|
||||
PRInt32
|
||||
_PR_MD_RMDIR(const char *name)
|
||||
{
|
||||
if (RemoveDirectory(name)) {
|
||||
if (RemoveDirectoryA(name)) {
|
||||
return 0;
|
||||
} else {
|
||||
_PR_MD_MAP_RMDIR_ERROR(GetLastError());
|
||||
@ -1358,6 +1448,15 @@ static void InitUnicodeSupport(void)
|
||||
#ifdef MOZ_UNICODE
|
||||
|
||||
/* ================ UTF16 Interfaces ================================ */
|
||||
static void FlipSlashesW(PRUnichar *cp, size_t len)
|
||||
{
|
||||
while (len-- > 0) {
|
||||
if (cp[0] == L'/') {
|
||||
cp[0] = L'\\';
|
||||
}
|
||||
cp++;
|
||||
}
|
||||
} /* end FlipSlashesW() */
|
||||
|
||||
PROsfd
|
||||
_PR_MD_OPEN_FILE_UTF16(const PRUnichar *name, PRIntn osflags, int mode)
|
||||
|
@ -94,9 +94,9 @@ ifeq ($(NS_USE_GCC)_$(OS_ARCH),_WINNT)
|
||||
$(OBJDIR)/prdtoa.$(OBJ_SUFFIX): prdtoa.c
|
||||
@$(MAKE_OBJDIR)
|
||||
ifeq (,$(filter-out 1100 1200 1300 1310,$(MSC_VER)))
|
||||
$(CC) -Fo$@ -c $(CFLAGS) -Op $(call abspath,$<)
|
||||
$(CC) -Fo$@ -c $(CFLAGS) -Op $(call pr_abspath,$<)
|
||||
else
|
||||
$(CC) -Fo$@ -c $(CFLAGS) -fp:precise $(call abspath,$<)
|
||||
$(CC) -Fo$@ -c $(CFLAGS) -fp:precise $(call pr_abspath,$<)
|
||||
endif
|
||||
endif
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user