Brought some more of the changes over from the trunk (needed the changes in xcDll.h/cpp).

git-svn-id: svn://10.0.0.236/branches/LIBREG990212_BRANCH@21501 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
mcmullen%netscape.com
1999-02-22 23:24:03 +00:00
parent 249c9a91cc
commit 509501efbf
6 changed files with 106 additions and 26 deletions

View File

@@ -234,7 +234,7 @@ static nsDll *platformCreateDll(const char *fullname)
}
PRTime lastModTime = LL_ZERO;
PRUint64 fileSize = LL_ZERO;
PRUint32 fileSize = 0;
uint32 n = sizeof(lastModTime);
NR_RegGetEntry(hreg, key, "LastModTimeStamp", &lastModTime, &n);
n = sizeof(fileSize);
@@ -282,7 +282,7 @@ static nsresult platformMarkNoComponents(nsDll *dll)
}
PRTime lastModTime = dll->GetLastModifiedTime();
PRUint64 fileSize = dll->GetSize();
PRUint32 fileSize = dll->GetSize();
NR_RegSetEntry(hreg, key, "LastModTimeStamp", REGTYPE_ENTRY_BYTES,
&lastModTime, sizeof(lastModTime));
NR_RegSetEntry(hreg, key, "FileSize", REGTYPE_ENTRY_BYTES,
@@ -352,7 +352,7 @@ static nsresult platformRegister(NSQuickRegisterData regd, nsDll *dll)
NR_RegAddKey(hreg, xpcomKey, (char *)dll->GetFullPath(), &key);
PRTime lastModTime = dll->GetLastModifiedTime();
PRUint64 fileSize = dll->GetSize();
PRUint32 fileSize = dll->GetSize();
NR_RegSetEntry(hreg, key, "LastModTimeStamp", REGTYPE_ENTRY_BYTES,
&lastModTime, sizeof(lastModTime));
@@ -477,7 +477,7 @@ static FactoryEntry *platformFind(const nsCID &aCID)
// Get the library name, modifiedtime and size
PRTime lastModTime = LL_ZERO;
PRUint64 fileSize = LL_ZERO;
PRUint32 fileSize = 0;
char buf[MAXREGNAMELEN];
uint32 len = sizeof(buf);
@@ -1186,7 +1186,7 @@ nsresult nsRepository::AutoRegister(NSRegistrationInstant when,
ProcessSerialNumber psn;
ProcessInfoRec pInfo;
FSSpec appFSSpec;
long theDirID, oldLen, newLen;
long theDirID;
Str255 name;
#endif

View File

@@ -31,7 +31,7 @@ nsDll::nsDll(const char *libFullPath) : m_fullpath(NULL), m_instance(NULL),
m_status(DLL_OK)
{
m_lastModTime = LL_ZERO;
m_size = LL_ZERO;
m_size = 0;
if (libFullPath == NULL)
{
@@ -46,8 +46,8 @@ nsDll::nsDll(const char *libFullPath) : m_fullpath(NULL), m_instance(NULL),
return;
}
PRFileInfo64 statinfo;
if (PR_GetFileInfo64(m_fullpath, &statinfo) != PR_SUCCESS)
PRFileInfo statinfo;
if (PR_GetFileInfo(m_fullpath, &statinfo) != PR_SUCCESS)
{
// The stat things works only if people pass in the full pathname.
// Even if our stat fails, we could be able to load it because of
@@ -71,7 +71,7 @@ nsDll::nsDll(const char *libFullPath) : m_fullpath(NULL), m_instance(NULL),
}
nsDll::nsDll(const char *libFullPath, PRTime lastModTime, PRUint64 fileSize)
nsDll::nsDll(const char *libFullPath, PRTime lastModTime, PRUint32 fileSize)
: m_fullpath(NULL), m_instance(NULL), m_status(DLL_OK)
{
m_lastModTime = lastModTime;
@@ -101,8 +101,17 @@ nsDll::~nsDll(void)
m_fullpath = NULL;
}
PRBool nsDll::Load(void)
{
// Of course, this is all buggy, because it uses paths instead of nsFileSpec.
// Also, instead of writing yet another converter for path separators, for
// pete's sake use the converters in nsFileSpec.h. Thank you.
#ifdef XP_MAC
char *macFileName = NULL;
int loop;
#endif
if (m_status != DLL_OK)
{
return (PR_FALSE);
@@ -112,7 +121,38 @@ PRBool nsDll::Load(void)
// Already loaded
return (PR_TRUE);
}
m_instance = PR_LoadLibrary(m_fullpath);
#ifdef XP_MAC
// err = ConvertUnixPathToMacPath(m_fullpath, &macFileName);
if ((macFileName = PL_strdup(m_fullpath)) != NULL)
{
if (macFileName[0] == '/')
{
for (loop=0; loop<PL_strlen(macFileName); loop++)
{
if (macFileName[loop] == '/') macFileName[loop] = ':';
}
m_instance = PR_LoadLibrary(&macFileName[1]); // skip over initial slash
}
else
{
m_instance = PR_LoadLibrary(macFileName);
}
}
#else
#ifdef XP_UNIX
// On linux we seem to load multiple copies of the same dll but with different path
// like libraptorhtml.so and ./libraptorhtml.so
// Until this get fixed right, for now for ./libraptorhtml.so remove the "./"
if (m_fullpath[0] == '.' && m_fullpath[1] == '/')
m_instance = PR_LoadLibrary( &(m_fullpath[2]) );
else
#endif /* XP_UNIX */
{
// This is the only right way of doing this...
m_instance = PR_LoadLibrary(m_fullpath);
}
#endif /* XP_MAC */
return ((m_instance == NULL) ? PR_FALSE : PR_TRUE);
}

View File

@@ -41,14 +41,14 @@ class nsDll
private:
char *m_fullpath; // system format full filename of dll
PRTime m_lastModTime; // last modified time
PRUint64 m_size; // size of the dynamic library
PRUint32 m_size; // size of the dynamic library
PRLibrary *m_instance; // Load instance
nsDllStatus m_status; // holds current status
public:
nsDll(const char *libFullPath);
nsDll(const char *libFullPath, PRTime lastModTime, PRUint64 fileSize);
nsDll(const char *libFullPath, PRTime lastModTime, PRUint32 fileSize);
~nsDll(void);
@@ -66,6 +66,6 @@ public:
const char *GetFullPath(void) { return (m_fullpath); }
PRTime GetLastModifiedTime(void) { return(m_lastModTime); }
PRUint64 GetSize(void) { return(m_size); }
PRUint32 GetSize(void) { return(m_size); }
PRLibrary *GetInstance(void) { return (m_instance); }
};

View File

@@ -234,7 +234,7 @@ static nsDll *platformCreateDll(const char *fullname)
}
PRTime lastModTime = LL_ZERO;
PRUint64 fileSize = LL_ZERO;
PRUint32 fileSize = 0;
uint32 n = sizeof(lastModTime);
NR_RegGetEntry(hreg, key, "LastModTimeStamp", &lastModTime, &n);
n = sizeof(fileSize);
@@ -282,7 +282,7 @@ static nsresult platformMarkNoComponents(nsDll *dll)
}
PRTime lastModTime = dll->GetLastModifiedTime();
PRUint64 fileSize = dll->GetSize();
PRUint32 fileSize = dll->GetSize();
NR_RegSetEntry(hreg, key, "LastModTimeStamp", REGTYPE_ENTRY_BYTES,
&lastModTime, sizeof(lastModTime));
NR_RegSetEntry(hreg, key, "FileSize", REGTYPE_ENTRY_BYTES,
@@ -352,7 +352,7 @@ static nsresult platformRegister(NSQuickRegisterData regd, nsDll *dll)
NR_RegAddKey(hreg, xpcomKey, (char *)dll->GetFullPath(), &key);
PRTime lastModTime = dll->GetLastModifiedTime();
PRUint64 fileSize = dll->GetSize();
PRUint32 fileSize = dll->GetSize();
NR_RegSetEntry(hreg, key, "LastModTimeStamp", REGTYPE_ENTRY_BYTES,
&lastModTime, sizeof(lastModTime));
@@ -477,7 +477,7 @@ static FactoryEntry *platformFind(const nsCID &aCID)
// Get the library name, modifiedtime and size
PRTime lastModTime = LL_ZERO;
PRUint64 fileSize = LL_ZERO;
PRUint32 fileSize = 0;
char buf[MAXREGNAMELEN];
uint32 len = sizeof(buf);
@@ -1186,7 +1186,7 @@ nsresult nsRepository::AutoRegister(NSRegistrationInstant when,
ProcessSerialNumber psn;
ProcessInfoRec pInfo;
FSSpec appFSSpec;
long theDirID, oldLen, newLen;
long theDirID;
Str255 name;
#endif

View File

@@ -31,7 +31,7 @@ nsDll::nsDll(const char *libFullPath) : m_fullpath(NULL), m_instance(NULL),
m_status(DLL_OK)
{
m_lastModTime = LL_ZERO;
m_size = LL_ZERO;
m_size = 0;
if (libFullPath == NULL)
{
@@ -46,8 +46,8 @@ nsDll::nsDll(const char *libFullPath) : m_fullpath(NULL), m_instance(NULL),
return;
}
PRFileInfo64 statinfo;
if (PR_GetFileInfo64(m_fullpath, &statinfo) != PR_SUCCESS)
PRFileInfo statinfo;
if (PR_GetFileInfo(m_fullpath, &statinfo) != PR_SUCCESS)
{
// The stat things works only if people pass in the full pathname.
// Even if our stat fails, we could be able to load it because of
@@ -71,7 +71,7 @@ nsDll::nsDll(const char *libFullPath) : m_fullpath(NULL), m_instance(NULL),
}
nsDll::nsDll(const char *libFullPath, PRTime lastModTime, PRUint64 fileSize)
nsDll::nsDll(const char *libFullPath, PRTime lastModTime, PRUint32 fileSize)
: m_fullpath(NULL), m_instance(NULL), m_status(DLL_OK)
{
m_lastModTime = lastModTime;
@@ -101,8 +101,17 @@ nsDll::~nsDll(void)
m_fullpath = NULL;
}
PRBool nsDll::Load(void)
{
// Of course, this is all buggy, because it uses paths instead of nsFileSpec.
// Also, instead of writing yet another converter for path separators, for
// pete's sake use the converters in nsFileSpec.h. Thank you.
#ifdef XP_MAC
char *macFileName = NULL;
int loop;
#endif
if (m_status != DLL_OK)
{
return (PR_FALSE);
@@ -112,7 +121,38 @@ PRBool nsDll::Load(void)
// Already loaded
return (PR_TRUE);
}
m_instance = PR_LoadLibrary(m_fullpath);
#ifdef XP_MAC
// err = ConvertUnixPathToMacPath(m_fullpath, &macFileName);
if ((macFileName = PL_strdup(m_fullpath)) != NULL)
{
if (macFileName[0] == '/')
{
for (loop=0; loop<PL_strlen(macFileName); loop++)
{
if (macFileName[loop] == '/') macFileName[loop] = ':';
}
m_instance = PR_LoadLibrary(&macFileName[1]); // skip over initial slash
}
else
{
m_instance = PR_LoadLibrary(macFileName);
}
}
#else
#ifdef XP_UNIX
// On linux we seem to load multiple copies of the same dll but with different path
// like libraptorhtml.so and ./libraptorhtml.so
// Until this get fixed right, for now for ./libraptorhtml.so remove the "./"
if (m_fullpath[0] == '.' && m_fullpath[1] == '/')
m_instance = PR_LoadLibrary( &(m_fullpath[2]) );
else
#endif /* XP_UNIX */
{
// This is the only right way of doing this...
m_instance = PR_LoadLibrary(m_fullpath);
}
#endif /* XP_MAC */
return ((m_instance == NULL) ? PR_FALSE : PR_TRUE);
}

View File

@@ -41,14 +41,14 @@ class nsDll
private:
char *m_fullpath; // system format full filename of dll
PRTime m_lastModTime; // last modified time
PRUint64 m_size; // size of the dynamic library
PRUint32 m_size; // size of the dynamic library
PRLibrary *m_instance; // Load instance
nsDllStatus m_status; // holds current status
public:
nsDll(const char *libFullPath);
nsDll(const char *libFullPath, PRTime lastModTime, PRUint64 fileSize);
nsDll(const char *libFullPath, PRTime lastModTime, PRUint32 fileSize);
~nsDll(void);
@@ -66,6 +66,6 @@ public:
const char *GetFullPath(void) { return (m_fullpath); }
PRTime GetLastModifiedTime(void) { return(m_lastModTime); }
PRUint64 GetSize(void) { return(m_size); }
PRUint32 GetSize(void) { return(m_size); }
PRLibrary *GetInstance(void) { return (m_instance); }
};