From ee3cfca3041dea19465b740e78e28eb426eee172 Mon Sep 17 00:00:00 2001 From: "dveditz%netscape.com" Date: Sat, 4 Sep 1999 19:46:18 +0000 Subject: [PATCH] remove xp_file.h from NSReg.h, required minor tweaking elsewhere to include now missing NSPR types. git-svn-id: svn://10.0.0.236/trunk@46020 18797224-902f-48f8-a5cc-f745e15eee43 --- mozilla/modules/libreg/include/NSReg.h | 6 +-- mozilla/modules/libreg/include/VerReg.h | 6 +-- mozilla/modules/libreg/src/Makefile.in | 2 + mozilla/modules/libreg/src/VerReg.c | 15 ++++--- mozilla/modules/libreg/src/makefile.win | 3 ++ mozilla/modules/libreg/src/reg.c | 44 ++++++++++--------- mozilla/modules/libreg/src/vr_stubs.h | 37 ++-------------- mozilla/modules/libreg/xpcom/nsRegistry.cpp | 1 + .../src/nsPrefMigrationFactory.cpp | 2 +- mozilla/xpcom/components/nsRegistry.cpp | 1 + mozilla/xpinstall/src/nsInstallPatch.cpp | 12 ++--- 11 files changed, 54 insertions(+), 75 deletions(-) diff --git a/mozilla/modules/libreg/include/NSReg.h b/mozilla/modules/libreg/include/NSReg.h index df207b55b4c..a66dd4a392d 100644 --- a/mozilla/modules/libreg/include/NSReg.h +++ b/mozilla/modules/libreg/include/NSReg.h @@ -26,8 +26,6 @@ #ifndef _NSREG_H_ #define _NSREG_H_ -#include "xp_core.h" - typedef void (*nr_RegPackCallbackFunc) (void *userData, int32 bytes, int32 totalBytes); typedef int32 REGERR; @@ -122,7 +120,7 @@ typedef struct _reginfo #define VR_INTERFACE(type) type #endif -XP_BEGIN_PROTOS +PR_BEGIN_EXTERN_C @@ -520,7 +518,7 @@ VR_INTERFACE(void) NR_ShutdownRegistry(void); VR_INTERFACE(REGERR) NR_StartupRegistry(void); -XP_END_PROTOS +PR_END_EXTERN_C #endif /* _NSREG_H_ */ diff --git a/mozilla/modules/libreg/include/VerReg.h b/mozilla/modules/libreg/include/VerReg.h index f90e3c39e12..89724e29d73 100644 --- a/mozilla/modules/libreg/include/VerReg.h +++ b/mozilla/modules/libreg/include/VerReg.h @@ -42,7 +42,7 @@ typedef struct _version /* CreateRegistry flags */ #define CR_NEWREGISTRY 1 -XP_BEGIN_PROTOS +PR_BEGIN_EXTERN_C /* --------------------------------------------------------------------- * Version Registry Operations * --------------------------------------------------------------------- @@ -78,10 +78,10 @@ VR_INTERFACE(REGERR) VR_UninstallDeleteFileFromList(char *component_path, char * VR_INTERFACE(REGERR) VR_UninstallDeleteSharedFilesKey(char *regPackageName); VR_INTERFACE(REGERR) VR_UninstallDestroy(char *regPackageName); VR_INTERFACE(REGERR) VR_EnumUninstall(REGENUM *state, char* userPackageName, - int32 len1, char*regPackageName, int32 len2, Bool bSharedList); + int32 len1, char*regPackageName, int32 len2, PRBool bSharedList); VR_INTERFACE(REGERR) VR_GetUninstallUserName(char *regPackageName, char *outbuf, uint32 buflen); -XP_END_PROTOS +PR_END_EXTERN_C #endif /* _VERREG_H_ */ diff --git a/mozilla/modules/libreg/src/Makefile.in b/mozilla/modules/libreg/src/Makefile.in index 102c37f3b0e..2129b42a2a4 100644 --- a/mozilla/modules/libreg/src/Makefile.in +++ b/mozilla/modules/libreg/src/Makefile.in @@ -40,6 +40,8 @@ override NO_STATIC_LIB= include $(topsrcdir)/config/rules.mk +DEFINES += -DUSE_MMAP_REGISTRY_IO + # Override gtscc when building vreg on IRIX 5.3. ifeq ($(OS_ARCH)$(OS_RELEASE),IRIX5) ifneq ($(CC),gcc) diff --git a/mozilla/modules/libreg/src/VerReg.c b/mozilla/modules/libreg/src/VerReg.c index 612d089f682..6fb6a9c81ca 100644 --- a/mozilla/modules/libreg/src/VerReg.c +++ b/mozilla/modules/libreg/src/VerReg.c @@ -43,10 +43,11 @@ #include #endif -#ifdef STANDALONE_REGISTRY #include -#include #include + +#ifdef STANDALONE_REGISTRY +#include #include #endif /*STANDALONE_REGISTRY*/ @@ -120,7 +121,7 @@ PRLock *vr_lock = NULL; * --------------------------------------------------------------------- */ static REGERR vr_Init(void); -static Bool vr_CompareDirs( char *dir1, char *dir2 ); +static XP_Bool vr_CompareDirs( char *dir1, char *dir2 ); static REGERR vr_SetCurrentNav( char *product, char *programPath, char *versionStr); static REGERR vr_ParseVersion(char *verstr, VERSION *result); @@ -279,7 +280,7 @@ done: #define VR_FILE_SEP '/' #endif -static Bool vr_CompareDirs( char *dir1, char *dir2 ) +static XP_Bool vr_CompareDirs( char *dir1, char *dir2 ) { int len1,len2; len1 = XP_STRLEN( dir1 ); @@ -1128,8 +1129,8 @@ VR_INTERFACE(REGERR) VR_GetRefCount(char *component_path, int *result) static REGERR vr_GetUninstallItemPath(char *regPackageName, char *regbuf, uint32 regbuflen) { - Bool bSharedUninstall = FALSE; - Bool bNavPackage = FALSE; + XP_Bool bSharedUninstall = FALSE; + XP_Bool bNavPackage = FALSE; uint32 len = 0; uint32 sharedstrlen = 0; uint32 curstrlen = 0; @@ -1755,7 +1756,7 @@ VR_INTERFACE(REGERR) VR_UninstallDestroy(char *component_path) } /* UninstallDestroy */ VR_INTERFACE(REGERR) VR_EnumUninstall(REGENUM *state, char* userPackageName, - int32 len1, char*regPackageName, int32 len2, Bool bSharedList) + int32 len1, char*regPackageName, int32 len2, XP_Bool bSharedList) { REGERR err; RKEY key; diff --git a/mozilla/modules/libreg/src/makefile.win b/mozilla/modules/libreg/src/makefile.win index 9f6d93cd129..8a62439189e 100644 --- a/mozilla/modules/libreg/src/makefile.win +++ b/mozilla/modules/libreg/src/makefile.win @@ -47,6 +47,7 @@ OBJS= \ .\$(OBJDIR)\reg.obj \ .\$(OBJDIR)\VerReg.obj \ .\$(OBJDIR)\vr_stubs.obj \ +# .\$(OBJDIR)\mmapio.obj \ $(NULL) #//------------------------------------------------------------------------ @@ -68,6 +69,8 @@ DLL=$(OBJDIR)\$(DLLNAME).dll #// #//------------------------------------------------------------------------ +#LCFLAGS= -DUSE_MMAP_REGISTRY_IO + LLIBS = \ $(LIBNSPR) \ !if "$(MOZ_BITS)"=="32" && defined(MOZ_DEBUG) && defined(GLOWCODE) diff --git a/mozilla/modules/libreg/src/reg.c b/mozilla/modules/libreg/src/reg.c index bdea636697d..68454589cb3 100644 --- a/mozilla/modules/libreg/src/reg.c +++ b/mozilla/modules/libreg/src/reg.c @@ -38,16 +38,18 @@ * NOCACHE_HDR - define if multi-threaded access to registry * SELF_REPAIR - define to skip header update on open * VERIFY_READ - define TRUE to double-check short reads - */ + * #define NOCACHE_HDR 1 + */ #define SELF_REPAIR 1 #ifdef DEBUG #define VERIFY_READ 1 #endif +#include + #ifdef STANDALONE_REGISTRY #include -#include #include #include #include @@ -58,6 +60,8 @@ #else +#include "prtypes.h" +#include "prlog.h" #include "prerror.h" #endif /*STANDALONE_REGISTRY*/ @@ -391,7 +395,7 @@ static REGERR nr_OpenFile(char *path, FILEHANDLE *fh) case PR_FILE_IS_LOCKED_ERROR: case PR_ILLEGAL_ACCESS_ERROR: case PR_NO_ACCESS_RIGHTS_ERROR: - /* DVNOTE: should we try read only? */ + /* try read only */ (*fh) = XP_FileOpen(path, PR_RDONLY, 00644); if ( VALID_FILEHANDLE(*fh) ) return REGERR_READONLY; @@ -573,7 +577,7 @@ static uint16 nr_ReadShort(char *buffer) uint16 val; uint8 *p = (uint8*)buffer; - val = *p + (uint16)( *(p+1) * 0x100 ); + val = (uint16)(*p + (uint16)( *(p+1) * 0x100 )); return val; } @@ -1237,7 +1241,7 @@ static REGERR nr_ReplaceName(REGFILE *reg, REGOFF node, char *path, #if 0 /* old interface */ static char * nr_LastDelim(char *pPath); -static Bool nr_IsQualifiedEntry(char *pPath); +static XP_Bool nr_IsQualifiedEntry(char *pPath); static REGERR nr_SplitEntry(char *pPath, char **name, char **value); static REGERR nr_CatNameValue(char *path, int bufsize, REGDESC *desc); static REGERR nr_ReplaceNameValue(char *path, int bufsize, REGDESC *desc); @@ -1423,7 +1427,7 @@ static REGERR nr_RemoveName(char *path) * -------------------------------------------------------------------- */ static REGERR nr_Find(REGFILE *reg, REGOFF offParent, char *pPath, - REGDESC *pDesc, REGOFF *pPrev, REGOFF *pParent, Bool raw); + REGDESC *pDesc, REGOFF *pPrev, REGOFF *pParent, XP_Bool raw); static REGERR nr_FindAtLevel(REGFILE *reg, REGOFF offFirst, char *pName, REGDESC *pDesc, REGOFF *pOffPrev); @@ -1443,7 +1447,7 @@ static REGERR nr_Find(REGFILE *reg, REGDESC *pDesc, REGOFF *pPrev, REGOFF *pParent, - Bool raw) + XP_Bool raw) { REGERR err; @@ -1799,15 +1803,15 @@ cleanup: * Intermediate API * --------------------------------------------------------------------- */ -static REGOFF nr_TranslateKey( REGFILE *reg, RKEY key ); -static REGERR nr_InitStdRkeys( REGFILE *reg ); -static Bool nr_ProtectedNode( REGFILE *reg, REGOFF key ); -static REGERR nr_RegAddKey( REGFILE *reg, RKEY key, char *path, RKEY *newKey, Bool raw ); -static REGERR nr_RegDeleteKey( REGFILE *reg, RKEY key, char *path, Bool raw ); -static REGERR nr_RegOpen( char *filename, HREG *hReg ); -static REGERR nr_RegClose( HREG hReg ); -static char* nr_GetUsername(); -static char* nr_GetRegName (char *name); +static REGOFF nr_TranslateKey( REGFILE *reg, RKEY key ); +static REGERR nr_InitStdRkeys( REGFILE *reg ); +static XP_Bool nr_ProtectedNode( REGFILE *reg, REGOFF key ); +static REGERR nr_RegAddKey( REGFILE *reg, RKEY key, char *path, RKEY *newKey, XP_Bool raw ); +static REGERR nr_RegDeleteKey( REGFILE *reg, RKEY key, char *path, XP_Bool raw ); +static REGERR nr_RegOpen( char *filename, HREG *hReg ); +static REGERR nr_RegClose( HREG hReg ); +static char* nr_GetUsername(); +static char* nr_GetRegName (char *name); /* --------------------------------------------------------------------- */ @@ -1934,7 +1938,7 @@ static REGERR nr_InitStdRkeys( REGFILE *reg ) -static Bool nr_ProtectedNode( REGFILE *reg, REGOFF key ) +static XP_Bool nr_ProtectedNode( REGFILE *reg, REGOFF key ) { if ( (key == reg->hdr.root) || (key == reg->rkeys.users) || @@ -1950,7 +1954,7 @@ static Bool nr_ProtectedNode( REGFILE *reg, REGOFF key ) -static REGERR nr_RegAddKey( REGFILE *reg, RKEY key, char *path, RKEY *newKey, Bool raw ) +static REGERR nr_RegAddKey( REGFILE *reg, RKEY key, char *path, RKEY *newKey, XP_Bool raw ) { REGERR err; REGDESC desc; @@ -2024,7 +2028,7 @@ static REGERR nr_RegAddKey( REGFILE *reg, RKEY key, char *path, RKEY *newKey, Bo -static REGERR nr_RegDeleteKey( REGFILE *reg, RKEY key, char *path, Bool raw ) +static REGERR nr_RegDeleteKey( REGFILE *reg, RKEY key, char *path, XP_Bool raw ) { REGERR err; REGOFF start; @@ -3634,7 +3638,7 @@ static REGERR nr_addNodesToNewReg( HREG hReg, RKEY rootkey, HREG hRegNew, void * static REGERR nr_createTempRegName( char *filename, uint32 filesize ) { struct stat statbuf; - Bool nameFound = FALSE; + XP_Bool nameFound = FALSE; char tmpname[MAX_PATH]; uint32 len; int err; diff --git a/mozilla/modules/libreg/src/vr_stubs.h b/mozilla/modules/libreg/src/vr_stubs.h index 97d657a3c29..f99a061bb23 100644 --- a/mozilla/modules/libreg/src/vr_stubs.h +++ b/mozilla/modules/libreg/src/vr_stubs.h @@ -153,11 +153,6 @@ typedef FILE * XP_File; #define SEEK_END PR_SEEK_END #endif -#if defined(XP_UNIX) -#define USE_MMAP_REGISTRY_IO 1 -#else -#define USE_MMAP_REGISTRY_IO 0 -#endif #if USE_MMAP_REGISTRY_IO @@ -183,8 +178,8 @@ typedef MmioFile* XP_File; #define XP_FileRead(dest,count,file) PR_Read((file), (dest), (count)) #define XP_FileWrite(src,count,file) PR_Write((file), (src), (count)) #define XP_FileTell(file) PR_Seek(file, 0, PR_SEEK_CUR) -#define XP_FileClose(file) PR_Close(file) #define XP_FileOpen(path, flags, mode) PR_Open((path), (flags), (mode)) +#define XP_FileClose(file) PR_Close(file) #ifdef XP_MAC #define XP_FileFlush(file) PR_Sync(file) #else @@ -219,36 +214,10 @@ typedef PRFileDesc* XP_File; #ifdef STANDALONE_REGISTRY /* included from prmon.h otherwise */ #include "prtypes.h" - -#if 0 -typedef long int32; -typedef unsigned long uint32; -typedef short int16; -typedef unsigned short uint16; -typedef unsigned char uint8; - -#ifdef XP_MAC -#include - typedef char BOOL; - typedef char Bool; - typedef char XP_Bool; -#elif defined(XP_PC) - typedef int Bool; - typedef int XP_Bool; -#else - /* XP_UNIX: X11/Xlib.h "define"s Bool to be int. This is really lame - * (that's what typedef is for losers). So.. in lieu of a #undef Bool - * here (Xlib still needs ints for Bool-typed parameters) people have - * been #undef-ing Bool before including this file. - * Can we just #undef Bool here? (help from djw, converse) - */ - - typedef char Bool; - typedef char XP_Bool; -#endif /* XP_MAC */ -#endif /* 0 */ #endif /*STANDALONE_REGISTRY*/ +typedef int XP_Bool; + #ifdef XP_PC typedef struct _stat XP_StatStruct; #define XP_Stat(file,data,type) _stat((file),(data)) diff --git a/mozilla/modules/libreg/xpcom/nsRegistry.cpp b/mozilla/modules/libreg/xpcom/nsRegistry.cpp index 803c9b2674c..e45c2a37ed3 100644 --- a/mozilla/modules/libreg/xpcom/nsRegistry.cpp +++ b/mozilla/modules/libreg/xpcom/nsRegistry.cpp @@ -22,6 +22,7 @@ #include "NSReg.h" #include "prmem.h" #include "prlock.h" +#include "prlog.h" /* extra locking for the paranoid */ /* #define EXTRA_THREADSAFE */ diff --git a/mozilla/profile/pref-migrator/src/nsPrefMigrationFactory.cpp b/mozilla/profile/pref-migrator/src/nsPrefMigrationFactory.cpp index 732293818f8..c4f0c153bda 100644 --- a/mozilla/profile/pref-migrator/src/nsPrefMigrationFactory.cpp +++ b/mozilla/profile/pref-migrator/src/nsPrefMigrationFactory.cpp @@ -21,7 +21,7 @@ #include "pratom.h" #include "nsIComponentManager.h" #include "nsIServiceManager.h" -#include "VerReg.h" +#include "NSReg.h" #include "nsCOMPtr.h" #include "nsPrefMigration.h" diff --git a/mozilla/xpcom/components/nsRegistry.cpp b/mozilla/xpcom/components/nsRegistry.cpp index 803c9b2674c..e45c2a37ed3 100644 --- a/mozilla/xpcom/components/nsRegistry.cpp +++ b/mozilla/xpcom/components/nsRegistry.cpp @@ -22,6 +22,7 @@ #include "NSReg.h" #include "prmem.h" #include "prlock.h" +#include "prlog.h" /* extra locking for the paranoid */ /* #define EXTRA_THREADSAFE */ diff --git a/mozilla/xpinstall/src/nsInstallPatch.cpp b/mozilla/xpinstall/src/nsInstallPatch.cpp index 4a334b72aef..66941c6ce48 100644 --- a/mozilla/xpinstall/src/nsInstallPatch.cpp +++ b/mozilla/xpinstall/src/nsInstallPatch.cpp @@ -29,8 +29,7 @@ #include "VerReg.h" #include "ScheduledTasks.h" #include "plstr.h" -#include "xp_file.h" /* for XP_PlatformFileToURL */ - +#include "prlog.h" #ifdef XP_MAC #include "PatchableAppleSingle.h" @@ -59,7 +58,7 @@ static int32 gdiff_add( pDIFFDATA dd, uint32 count ); static int32 gdiff_copy( pDIFFDATA dd, uint32 position, uint32 count ); static int32 gdiff_validateFile( pDIFFDATA dd, int file ); #ifdef WIN32 -static XP_Bool su_unbind(char* oldsrc, char* newsrc); +static PRBool su_unbind(char* oldsrc, char* newsrc); #endif @@ -854,7 +853,7 @@ static int32 gdiff_ApplyPatch( pDIFFDATA dd ) { int32 err; - XP_Bool done; + PRBool done; uint32 position; uint32 count; uchar opcode; @@ -1045,6 +1044,7 @@ int32 gdiff_copy( pDIFFDATA dd, uint32 position, uint32 count ) #ifdef WIN32 +#include /*--------------------------------------------------------- * su_unbind() * @@ -1053,9 +1053,9 @@ int32 gdiff_copy( pDIFFDATA dd, uint32 position, uint32 count ) *--------------------------------------------------------- */ static -XP_Bool su_unbind(char* oldfile, char* newfile) +PRBool su_unbind(char* oldfile, char* newfile) { - XP_Bool bSuccess = FALSE; + PRBool bSuccess = FALSE; int i; DWORD nRead;