Bug 425077 Migrate mail/components to frozen linkage for non-static linux builds. r/sr=bienvenu

git-svn-id: svn://10.0.0.236/trunk@248877 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
bugzilla%standard8.plus.com 2008-03-31 07:50:44 +00:00
parent 46a8dc9ad3
commit 36620a2b53
15 changed files with 86 additions and 43 deletions

View File

@ -48,7 +48,13 @@ SHORT_LIBNAME = mailcmp
EXPORT_LIBRARY = 1
IS_COMPONENT = 1
MODULE_NAME = nsMailCompsModule
ifdef BUILD_STATIC_LIBS
MOZILLA_INTERNAL_API = 1
else
ifneq ($(MOZ_WIDGET_TOOLKIT), gtk2)
MOZILLA_INTERNAL_API = 1
endif
endif
REQUIRES = \
xpcom \
@ -84,10 +90,18 @@ ifneq (,$(filter windows mac cocoa gtk2, $(MOZ_WIDGET_TOOLKIT)))
SHARED_LIBRARY_LIBS += ../shell/$(LIB_PREFIX)shellservice_s.$(LIB_SUFFIX)
endif
ifdef MOZILLA_INTERNAL_API
EXTRA_DSO_LDOPTS += \
$(LIBXUL_DIST)/../modules/libreg/src/$(LIB_PREFIX)mozreg_s.$(LIB_SUFFIX) \
$(MOZ_COMPONENT_LIBS) \
$(NULL)
else
EXTRA_DSO_LDOPTS += \
$(LIBXUL_DIST)/../modules/libreg/src/$(LIB_PREFIX)mozreg_s.$(LIB_SUFFIX) \
$(LIBXUL_DIST)/lib/$(LIB_PREFIX)xpcomglue_s.$(LIB_SUFFIX) \
$(MOZ_COMPONENT_LIBS) \
$(NULL)
endif
# Mac: Need to link to CoreFoundation for Mac shell service
# GTK2: Need to link with glib for GNOME shell service

View File

@ -8,7 +8,13 @@ include $(DEPTH)/config/autoconf.mk
MODULE=mailprofilemigration
LIBRARY_NAME = profilemigration_s
MODULE_NAME = nsMailProfileMigratorModule
ifdef BUILD_STATIC_LIBS
MOZILLA_INTERNAL_API = 1
else
ifneq ($(MOZ_WIDGET_TOOLKIT), gtk2)
MOZILLA_INTERNAL_API = 1
endif
endif
REQUIRES = \
string \

View File

@ -58,6 +58,7 @@
#include "prenv.h"
#include "NSReg.h"
#include "msgCore.h"
#include "nsDirectoryServiceUtils.h"
// lots of includes required for the nsPrefMigration.cpp code that we copied:
#include "nsICharsetConverterManager.h"
@ -1720,8 +1721,7 @@ nsresult nsDogbertProfileMigrator::DetermineOldPath(nsILocalFile *profilePath, c
if (NS_FAILED(rv)) return rv;
nsString localizedDirName;
nsAutoString entityName;
CopyASCIItoUTF16(oldPathEntityName, entityName);
NS_ConvertASCIItoUTF16 entityName(oldPathEntityName);
rv = bundle->GetStringFromName(entityName.get(), getter_Copies(localizedDirName));
if (NS_FAILED(rv)) return rv;
@ -1972,35 +1972,20 @@ nsresult nsDogbertProfileMigrator::ComputeSpaceRequirements(PRInt64 DriveArray[M
static PRBool
nsCStringEndsWith(nsCString& name, const char *ending)
{
if (!ending) return PR_FALSE;
if (!ending || name.IsEmpty())
return PR_FALSE;
PRInt32 len = name.Length();
if (len == 0) return PR_FALSE;
PRInt32 endingLen = PL_strlen(ending);
if (len > endingLen && name.RFind(ending, PR_TRUE) == len - endingLen) {
return PR_TRUE;
}
else {
return PR_FALSE;
}
return StringTail(name, PL_strlen(ending)).Equals(nsDependentCString(ending));
}
#ifdef NEED_TO_COPY_AND_RENAME_NEWSRC_FILES
static PRBool
nsCStringStartsWith(nsCString& name, const char *starting)
{
if (!starting) return PR_FALSE;
PRInt32 len = name.Length();
if (len == 0) return PR_FALSE;
if (!starting || name.IsEmpty())
return PR_FALSE;
PRInt32 startingLen = PL_strlen(starting);
if (len > startingLen && name.RFind(starting, PR_TRUE) == 0) {
return PR_TRUE;
}
else {
return PR_FALSE;
}
return StringHead(name, PL_strlen(starting)).Equals(nsDependentCString(starting));
}
#endif

View File

@ -43,7 +43,6 @@
#include "nsIObserverService.h"
#include "nsISupportsArray.h"
#include "nsNetscapeProfileMigratorBase.h"
#include "nsString.h"
#include "nsITimer.h"
#include "nsIPrefBranch.h"

View File

@ -55,7 +55,11 @@ void SetProxyPref(const nsACString& aHostPort, const char* aPref,
hostPort.Length() - (portDelimOffset + 1)));
aPrefs->SetCharPref(aPref, host.get());
#ifdef MOZILLA_INTERNAL_API
PRInt32 stringErr;
#else
PRUint32 stringErr;
#endif
PRInt32 portValue = port.ToInteger(&stringErr);
aPrefs->SetIntPref(aPortPref, portValue);
}

View File

@ -58,7 +58,8 @@
#include "nsIPrefBranch.h"
#include "nsIFile.h"
#include "nsString.h"
#include "nsStringGlue.h"
#include "nsCOMPtr.h"
class nsIProfileStartup;
// Proxy utilities shared by the Opera and IE migrators

View File

@ -52,7 +52,6 @@
#include "nsIURL.h"
#include "nsNetscapeProfileMigratorBase.h"
#include "nsNetUtil.h"
#include "nsReadableUtils.h"
#include "prtime.h"
#include "prprf.h"
#include "nsVoidArray.h"
@ -366,10 +365,17 @@ nsNetscapeProfileMigratorBase::LocateSignonsFile(char** aResult)
nsCAutoString extn;
url->GetFileExtension(extn);
#ifdef MOZILLA_INTERNAL_API
if (extn.EqualsIgnoreCase("s")) {
url->GetFileName(fileName);
break;
}
#else
if (extn.Equals("s", CaseInsensitiveCompare)) {
url->GetFileName(fileName);
break;
}
#endif
}
while (1);

View File

@ -41,7 +41,7 @@
#include "nsILocalFile.h"
#include "nsIStringBundle.h"
#include "nsString.h"
#include "nsStringGlue.h"
class nsIFile;
class nsIPrefBranch;
@ -64,8 +64,8 @@ public:
typedef nsresult(*prefConverter)(void*, nsIPrefBranch*);
struct PrefTransform {
char* sourcePrefName;
char* targetPrefName;
const char* sourcePrefName;
const char* targetPrefName;
prefConverter prefGetterFunc;
prefConverter prefSetterFunc;
PRBool prefHasValue;

View File

@ -46,14 +46,14 @@
#include "nsIWindowWatcher.h"
#include "nsISupportsPrimitives.h"
#include "nsISupportsArray.h"
#include "nsComponentManagerUtils.h"
#include "nsServiceManagerUtils.h"
#include "nsIProperties.h"
#include "nsDirectoryServiceDefs.h"
#include "nsProfileMigrator.h"
#include "nsMailMigrationCID.h"
#include "NSReg.h"
#include "nsReadableUtils.h"
#include "nsString.h"
#ifdef XP_WIN
#include <windows.h>
#endif

View File

@ -43,12 +43,11 @@
#include "nsIServiceManager.h"
#include "nsIToolkitProfile.h"
#include "nsIToolkitProfileService.h"
#include "nsCOMPtr.h"
#include "nsDirectoryServiceDefs.h"
#include "NSReg.h"
#include "nsReadableUtils.h"
#include "nsString.h"
#include "nsStringGlue.h"
#define NS_THUNDERBIRD_PROFILEIMPORT_CID \
{ 0xb3c78baf, 0x3a52, 0x41d2, { 0x97, 0x18, 0xc3, 0x19, 0xbe, 0xf9, 0xaf, 0xfc } }

View File

@ -393,10 +393,10 @@ nsSeamonkeyProfileMigrator::FillProfileDataFromSeamonkeyRegistry()
#define F(a) nsSeamonkeyProfileMigrator::a
#define MAKEPREFTRANSFORM(pref, newpref, getmethod, setmethod) \
{ pref, newpref, F(Get##getmethod), F(Set##setmethod), PR_FALSE, -1 }
{ pref, newpref, F(Get##getmethod), F(Set##setmethod), PR_FALSE, { -1 } }
#define MAKESAMETYPEPREFTRANSFORM(pref, method) \
{ pref, 0, F(Get##method), F(Set##method), PR_FALSE, -1 }
{ pref, 0, F(Get##method), F(Set##method), PR_FALSE, { -1 } }
static
@ -887,6 +887,26 @@ static PRUint32 StringHash(const char *ubuf)
}
return h;
}
#ifndef MOZILLA_INTERNAL_API
/// @see nsString::FindCharInSet
PRInt32 nsString_FindCharInSet(const nsACString& aString,
const char *aPattern, PRInt32 aOffset = 0)
{
const char *begin, *end;
aString.BeginReading(&begin, &end);
for (const char *current = begin + aOffset; current < end; ++current)
{
for (const char *pattern = aPattern; *pattern; ++pattern)
{
if (NS_UNLIKELY(*current == *pattern))
{
return current - begin;
}
}
}
return -1;
}
#endif
nsresult NS_MsgHashIfNecessary(nsCString &name)
{
@ -899,15 +919,17 @@ nsresult NS_MsgHashIfNecessary(nsCString &name)
#else
#error need_to_define_your_max_filename_length
#endif
nsCAutoString illegalChars(FILE_PATH_SEPARATOR FILE_ILLEGAL_CHARACTERS);
nsCAutoString str(name);
// Given a filename, make it safe for filesystem
// certain filenames require hashing because they
// are too long or contain illegal characters
PRInt32 illegalCharacterIndex = str.FindCharInSet(illegalChars);
char hashedname[MAX_LEN + 1];
if (illegalCharacterIndex == kNotFound)
#ifdef MOZILLA_INTERNAL_API
if (str.FindCharInSet(NS_LITERAL_CSTRING(FILE_PATH_SEPARATOR FILE_ILLEGAL_CHARACTERS)) == kNotFound)
#else
if (nsString_FindCharInSet(str, FILE_PATH_SEPARATOR FILE_ILLEGAL_CHARACTERS) == -1)
#endif
{
// no illegal chars, it's just too long
// keep the initial part of the string, but hash to make it fit

View File

@ -43,7 +43,6 @@
#include "nsIObserverService.h"
#include "nsISupportsArray.h"
#include "nsNetscapeProfileMigratorBase.h"
#include "nsString.h"
#include "nsITimer.h"
class nsIFile;

View File

@ -47,7 +47,13 @@ DIRS = public
MODULE = shellservice
LIBRARY_NAME = shellservice_s
MODULE_NAME = nsMailShellModule
ifdef BUILD_STATIC_LIBS
MOZILLA_INTERNAL_API = 1
else
ifneq ($(MOZ_WIDGET_TOOLKIT), gtk2)
MOZILLA_INTERNAL_API = 1
endif
endif
REQUIRES = \

View File

@ -50,6 +50,7 @@
#include "nsDirectoryServiceDefs.h"
#include "nsDirectoryServiceUtils.h"
#include "nsEmbedCID.h"
#include "nsMemory.h"
#include <glib.h>
#include <limits.h>
@ -220,7 +221,8 @@ nsMailGNOMEIntegration::MakeDefault(const char* const *aProtocols,
unsigned int aLength)
{
nsCOMPtr<nsIGConfService> gconf = do_GetService(NS_GCONFSERVICE_CONTRACTID);
nsCAutoString appKeyValue(mAppPath + NS_LITERAL_CSTRING(" \"%s\""));
nsCAutoString appKeyValue(mAppPath);
appKeyValue.AppendLiteral(" \"%s\"");
for (unsigned int i = 0; i < aLength; ++i) {
nsresult rv = gconf->SetAppForProtocol(nsDependentCString(aProtocols[i]),

View File

@ -41,7 +41,7 @@
#include "nsIShellService.h"
#include "nsIGenericFactory.h"
#include "nsString.h"
#include "nsStringGlue.h"
#define NS_MAILGNOMEINTEGRATION_CID \
{0xbddef0f4, 0x5e2d, 0x4846, {0xbd, 0xec, 0x86, 0xd0, 0x78, 0x1d, 0x8d, 0xed}}