--- a/browser/components/migration/src/nsDogbertProfileMigrator.cpp
+++ b/browser/components/migration/src/nsDogbertProfileMigrator.cpp
@@ -391,46 +391,46 @@ nsDogbertProfileMigrator::GetSourceHomeP
}
///////////////////////////////////////////////////////////////////////////////
// nsDogbertProfileMigrator
#define F(a) nsDogbertProfileMigrator::a
static
nsDogbertProfileMigrator::PrefTransform gTransforms[] = {
// Simple Copy Prefs
- { "browser.anchor_color", 0, F(GetString), F(SetString), PR_FALSE, -1 },
- { "browser.visited_color", 0, F(GetString), F(SetString), PR_FALSE, -1 },
- { "browser.startup.homepage", 0, F(GetString), F(SetString), PR_FALSE, -1 },
- { "security.enable_java", 0, F(GetBool), F(SetBool), PR_FALSE, -1 },
- { "network.cookie.cookieBehavior", 0, F(GetInt), F(SetInt), PR_FALSE, -1 },
- { "network.cookie.warnAboutCookies",0, F(GetBool), F(SetBool), PR_FALSE, -1 },
- { "javascript.enabled", 0, F(GetBool), F(SetBool), PR_FALSE, -1 },
- { "network.proxy.type", 0, F(GetInt), F(SetInt), PR_FALSE, -1 },
- { "network.proxy.no_proxies_on", 0, F(GetString), F(SetString), PR_FALSE, -1 },
- { "network.proxy.autoconfig_url", 0, F(GetString), F(SetString), PR_FALSE, -1 },
- { "network.proxy.ftp", 0, F(GetString), F(SetString), PR_FALSE, -1 },
- { "network.proxy.ftp_port", 0, F(GetInt), F(SetInt), PR_FALSE, -1 },
- { "network.proxy.gopher", 0, F(GetString), F(SetString), PR_FALSE, -1 },
- { "network.proxy.gopher_port", 0, F(GetInt), F(SetInt), PR_FALSE, -1 },
- { "network.proxy.http", 0, F(GetString), F(SetString), PR_FALSE, -1 },
- { "network.proxy.http_port", 0, F(GetInt), F(SetInt), PR_FALSE, -1 },
- { "network.proxy.ssl", 0, F(GetString), F(SetString), PR_FALSE, -1 },
- { "network.proxy.ssl_port", 0, F(GetInt), F(SetInt), PR_FALSE, -1 },
+ { "browser.anchor_color", 0, F(GetString), F(SetString), PR_FALSE, { -1 } },
+ { "browser.visited_color", 0, F(GetString), F(SetString), PR_FALSE, { -1 } },
+ { "browser.startup.homepage", 0, F(GetString), F(SetString), PR_FALSE, { -1 } },
+ { "security.enable_java", 0, F(GetBool), F(SetBool), PR_FALSE, { -1 } },
+ { "network.cookie.cookieBehavior", 0, F(GetInt), F(SetInt), PR_FALSE, { -1 } },
+ { "network.cookie.warnAboutCookies",0, F(GetBool), F(SetBool), PR_FALSE, { -1 } },
+ { "javascript.enabled", 0, F(GetBool), F(SetBool), PR_FALSE, { -1 } },
+ { "network.proxy.type", 0, F(GetInt), F(SetInt), PR_FALSE, { -1 } },
+ { "network.proxy.no_proxies_on", 0, F(GetString), F(SetString), PR_FALSE, { -1 } },
+ { "network.proxy.autoconfig_url", 0, F(GetString), F(SetString), PR_FALSE, { -1 } },
+ { "network.proxy.ftp", 0, F(GetString), F(SetString), PR_FALSE, { -1 } },
+ { "network.proxy.ftp_port", 0, F(GetInt), F(SetInt), PR_FALSE, { -1 } },
+ { "network.proxy.gopher", 0, F(GetString), F(SetString), PR_FALSE, { -1 } },
+ { "network.proxy.gopher_port", 0, F(GetInt), F(SetInt), PR_FALSE, { -1 } },
+ { "network.proxy.http", 0, F(GetString), F(SetString), PR_FALSE, { -1 } },
+ { "network.proxy.http_port", 0, F(GetInt), F(SetInt), PR_FALSE, { -1 } },
+ { "network.proxy.ssl", 0, F(GetString), F(SetString), PR_FALSE, { -1 } },
+ { "network.proxy.ssl_port", 0, F(GetInt), F(SetInt), PR_FALSE, { -1 } },
// Prefs with Different Names
- { "network.hosts.socks_server", "network.proxy.socks", F(GetString), F(SetString), PR_FALSE, -1 },
- { "network.hosts.socks_serverport", "network.proxy.socks_port", F(GetInt), F(SetInt), PR_FALSE, -1 },
- { "browser.background_color", "browser.display.background_color", F(GetString), F(SetString), PR_FALSE, -1 },
- { "browser.foreground_color", "browser.display.foreground_color", F(GetString), F(SetString), PR_FALSE, -1 },
- { "browser.wfe.use_windows_colors", "browser.display.use_system_colors", F(GetBool), F(SetBool), PR_FALSE, -1 },
- { "browser.use_document_colors", "browser.display.use_document_colors",F(GetBool), F(SetBool), PR_FALSE, -1 },
- { "browser.use_document.fonts", "browser.display.use_document_fonts", F(GetInt), F(SetInt), PR_FALSE, -1 },
- { "browser.link_expiration", "browser.history_expire_days", F(GetInt), F(SetInt), PR_FALSE, -1 },
- { "browser.startup.page", "browser.startup.homepage", F(GetHomepage), F(SetWStringFromASCII), PR_FALSE, -1 },
- { "general.always_load_images", "permissions.default.image", F(GetImagePref),F(SetInt), PR_FALSE, -1 },
+ { "network.hosts.socks_server", "network.proxy.socks", F(GetString), F(SetString), PR_FALSE, { -1 } },
+ { "network.hosts.socks_serverport", "network.proxy.socks_port", F(GetInt), F(SetInt), PR_FALSE, { -1 } },
+ { "browser.background_color", "browser.display.background_color", F(GetString), F(SetString), PR_FALSE, { -1 } },
+ { "browser.foreground_color", "browser.display.foreground_color", F(GetString), F(SetString), PR_FALSE, { -1 } },
+ { "browser.wfe.use_windows_colors", "browser.display.use_system_colors", F(GetBool), F(SetBool), PR_FALSE, { -1 } },
+ { "browser.use_document_colors", "browser.display.use_document_colors",F(GetBool), F(SetBool), PR_FALSE, { -1 } },
+ { "browser.use_document.fonts", "browser.display.use_document_fonts", F(GetInt), F(SetInt), PR_FALSE, { -1 } },
+ { "browser.link_expiration", "browser.history_expire_days", F(GetInt), F(SetInt), PR_FALSE, { -1 } },
+ { "browser.startup.page", "browser.startup.homepage", F(GetHomepage), F(SetWStringFromASCII), PR_FALSE, { -1 } },
+ { "general.always_load_images", "permissions.default.image", F(GetImagePref),F(SetInt), PR_FALSE, { -1 } },
};
nsresult
nsDogbertProfileMigrator::TransformPreferences(const nsAString& aSourcePrefFileName,
const nsAString& aTargetPrefFileName)
{
PrefTransform* transform;
PrefTransform* end = gTransforms + sizeof(gTransforms)/sizeof(PrefTransform);
--- a/browser/components/migration/src/nsNetscapeProfileMigratorBase.cpp
+++ b/browser/components/migration/src/nsNetscapeProfileMigratorBase.cpp
@@ -127,33 +127,33 @@ nsNetscapeProfileMigratorBase::GetProfil
{
RKEY profileKey;
if (NR_RegGetKey(reg, profilesTree, profileStr, &profileKey))
continue;
// "migrated" is "yes" for all valid Seamonkey profiles. It is only "no"
// for 4.x profiles.
char migratedStr[3];
- errCode = NR_RegGetEntryString(reg, profileKey, "migrated",
+ errCode = NR_RegGetEntryString(reg, profileKey, (char *)"migrated",
migratedStr, sizeof(migratedStr));
if ((errCode != REGERR_OK && errCode != REGERR_BUFTOOSMALL) ||
strcmp(migratedStr, "no") == 0)
continue;
// Get the profile location and add it to the locations array
REGINFO regInfo;
regInfo.size = sizeof(REGINFO);
- if (NR_RegGetEntryInfo(reg, profileKey, "directory", ®Info))
+ if (NR_RegGetEntryInfo(reg, profileKey, (char *)"directory", ®Info))
continue;
nsCAutoString dirStr;
dirStr.SetLength(regInfo.entryLength);
- errCode = NR_RegGetEntryString(reg, profileKey, "directory",
+ errCode = NR_RegGetEntryString(reg, profileKey, (char *)"directory",
dirStr.BeginWriting(), regInfo.entryLength);
// Remove trailing \0
dirStr.SetLength(regInfo.entryLength-1);
nsCOMPtr<nsILocalFile> dir;
#ifdef XP_MACOSX
rv = NS_NewNativeLocalFile(EmptyCString(), PR_TRUE, getter_AddRefs(dir));
if (NS_FAILED(rv)) break;
--- a/browser/components/migration/src/nsNetscapeProfileMigratorBase.h
+++ b/browser/components/migration/src/nsNetscapeProfileMigratorBase.h
@@ -51,18 +51,18 @@ class nsNetscapeProfileMigratorBase
public:
nsNetscapeProfileMigratorBase();
virtual ~nsNetscapeProfileMigratorBase() { }
public:
typedef nsresult(*prefConverter)(void*, nsIPrefBranch*);
struct PrefTransform {
- char* sourcePrefName;
- char* targetPrefName;
+ const char* sourcePrefName;
+ const char* targetPrefName;
prefConverter prefGetterFunc;
prefConverter prefSetterFunc;
PRBool prefHasValue;
union {
PRInt32 intValue;
PRBool boolValue;
char* stringValue;
};
--- a/browser/components/migration/src/nsOperaProfileMigrator.cpp
+++ b/browser/components/migration/src/nsOperaProfileMigrator.cpp
@@ -309,36 +309,36 @@ nsOperaProfileMigrator::GetSourceHomePag
return NS_OK;
}
#define _OPM(type) nsOperaProfileMigrator::type
static
nsOperaProfileMigrator::PrefTransform gTransforms[] = {
- { "User Prefs", "Download Directory", _OPM(STRING), "browser.download.dir", _OPM(SetFile), PR_FALSE, -1 },
- { nsnull, "Enable Cookies", _OPM(INT), "network.cookie.cookieBehavior", _OPM(SetCookieBehavior), PR_FALSE, -1 },
- { nsnull, "Accept Cookies Session Only", _OPM(BOOL), "network.cookie.lifetimePolicy", _OPM(SetCookieLifetime), PR_FALSE, -1 },
- { nsnull, "Allow script to resize window", _OPM(BOOL), "dom.disable_window_move_resize", _OPM(SetBool), PR_FALSE, -1 },
- { nsnull, "Allow script to move window", _OPM(BOOL), "dom.disable_window_move_resize", _OPM(SetBool), PR_FALSE, -1 },
- { nsnull, "Allow script to raise window", _OPM(BOOL), "dom.disable_window_flip", _OPM(SetBool), PR_FALSE, -1 },
- { nsnull, "Allow script to change status", _OPM(BOOL), "dom.disable_window_status_change", _OPM(SetBool), PR_FALSE, -1 },
- { nsnull, "Ignore Unrequested Popups", _OPM(BOOL), "dom.disable_open_during_load", _OPM(SetBool), PR_FALSE, -1 },
- { nsnull, "Load Figures", _OPM(BOOL), "permissions.default.image", _OPM(SetImageBehavior), PR_FALSE, -1 },
+ { "User Prefs", "Download Directory", _OPM(STRING), "browser.download.dir", _OPM(SetFile), PR_FALSE, { -1 } },
+ { nsnull, "Enable Cookies", _OPM(INT), "network.cookie.cookieBehavior", _OPM(SetCookieBehavior), PR_FALSE, { -1 } },
+ { nsnull, "Accept Cookies Session Only", _OPM(BOOL), "network.cookie.lifetimePolicy", _OPM(SetCookieLifetime), PR_FALSE, { -1 } },
+ { nsnull, "Allow script to resize window", _OPM(BOOL), "dom.disable_window_move_resize", _OPM(SetBool), PR_FALSE, { -1 } },
+ { nsnull, "Allow script to move window", _OPM(BOOL), "dom.disable_window_move_resize", _OPM(SetBool), PR_FALSE, { -1 } },
+ { nsnull, "Allow script to raise window", _OPM(BOOL), "dom.disable_window_flip", _OPM(SetBool), PR_FALSE, { -1 } },
+ { nsnull, "Allow script to change status", _OPM(BOOL), "dom.disable_window_status_change", _OPM(SetBool), PR_FALSE, { -1 } },
+ { nsnull, "Ignore Unrequested Popups", _OPM(BOOL), "dom.disable_open_during_load", _OPM(SetBool), PR_FALSE, { -1 } },
+ { nsnull, "Load Figures", _OPM(BOOL), "permissions.default.image", _OPM(SetImageBehavior), PR_FALSE, { -1 } },
- { "Visited link", nsnull, _OPM(COLOR), "browser.visited_color", _OPM(SetString), PR_FALSE, -1 },
- { "Link", nsnull, _OPM(COLOR), "browser.anchor_color", _OPM(SetString), PR_FALSE, -1 },
- { nsnull, "Underline", _OPM(BOOL), "browser.underline_anchors", _OPM(SetBool), PR_FALSE, -1 },
- { nsnull, "Expiry", _OPM(INT), "browser.history_expire_days", _OPM(SetInt), PR_FALSE, -1 },
+ { "Visited link", nsnull, _OPM(COLOR), "browser.visited_color", _OPM(SetString), PR_FALSE, { -1 } },
+ { "Link", nsnull, _OPM(COLOR), "browser.anchor_color", _OPM(SetString), PR_FALSE, { -1 } },
+ { nsnull, "Underline", _OPM(BOOL), "browser.underline_anchors", _OPM(SetBool), PR_FALSE, { -1 } },
+ { nsnull, "Expiry", _OPM(INT), "browser.history_expire_days", _OPM(SetInt), PR_FALSE, { -1 } },
- { "Security Prefs", "Enable SSL v2", _OPM(BOOL), "security.enable_ssl2", _OPM(SetBool), PR_FALSE, -1 },
- { nsnull, "Enable SSL v3", _OPM(BOOL), "security.enable_ssl3", _OPM(SetBool), PR_FALSE, -1 },
- { nsnull, "Enable TLS v1.0", _OPM(BOOL), "security.enable_tls", _OPM(SetBool), PR_FALSE, -1 },
+ { "Security Prefs", "Enable SSL v2", _OPM(BOOL), "security.enable_ssl2", _OPM(SetBool), PR_FALSE, { -1 } },
+ { nsnull, "Enable SSL v3", _OPM(BOOL), "security.enable_ssl3", _OPM(SetBool), PR_FALSE, { -1 } },
+ { nsnull, "Enable TLS v1.0", _OPM(BOOL), "security.enable_tls", _OPM(SetBool), PR_FALSE, { -1 } },
- { "Extensions", "Scripting", _OPM(BOOL), "javascript.enabled", _OPM(SetBool), PR_FALSE, -1 }
+ { "Extensions", "Scripting", _OPM(BOOL), "javascript.enabled", _OPM(SetBool), PR_FALSE, { -1 } }
};
nsresult
nsOperaProfileMigrator::SetFile(void* aTransform, nsIPrefBranch* aBranch)
{
PrefTransform* xform = (PrefTransform*)aTransform;
nsCOMPtr<nsILocalFile> lf(do_CreateInstance("@mozilla.org/file/local;1"));
lf->InitWithPath(NS_ConvertUTF8toUTF16(xform->stringValue));
@@ -415,27 +415,27 @@ nsOperaProfileMigrator::CopyPreferences(
NS_ENSURE_SUCCESS(rv, rv);
nsCOMPtr<nsIPrefBranch> branch(do_GetService(NS_PREFSERVICE_CONTRACTID));
// Traverse the standard transforms
PrefTransform* transform;
PrefTransform* end = gTransforms + sizeof(gTransforms)/sizeof(PrefTransform);
- char* lastSectionName = nsnull;
+ const char* lastSectionName = nsnull;
for (transform = gTransforms; transform < end; ++transform) {
if (transform->sectionName)
lastSectionName = transform->sectionName;
if (transform->type == _OPM(COLOR)) {
char* colorString = nsnull;
nsresult rv = ParseColor(parser, lastSectionName, &colorString);
if (NS_SUCCEEDED(rv)) {
transform->stringValue = colorString;
-
+
transform->prefHasValue = PR_TRUE;
transform->prefSetterFunc(transform, branch);
}
if (colorString)
free(colorString);
}
else {
nsCAutoString val;
@@ -876,19 +876,20 @@ nsOperaCookieMigrator::AddCookieOverride
nsCString domain;
SynthesizeDomain(getter_Copies(domain));
nsCOMPtr<nsIURI> uri(do_CreateInstance("@mozilla.org/network/standard-url;1"));
if (!uri)
return NS_ERROR_OUT_OF_MEMORY;
uri->SetHost(domain);
- rv = aManager->Add(uri, "cookie",
- (mCurrHandlingInfo == 1 || mCurrHandlingInfo == 3) ? nsIPermissionManager::ALLOW_ACTION :
- nsIPermissionManager::DENY_ACTION);
+ rv = aManager->Add(uri, "cookie",
+ (mCurrHandlingInfo == 1 || mCurrHandlingInfo == 3)
+ ? (PRUint32) nsIPermissionManager::ALLOW_ACTION
+ : (PRUint32) nsIPermissionManager::DENY_ACTION);
mCurrHandlingInfo = 0;
return rv;
}
nsresult
@@ -1159,32 +1160,32 @@ nsOperaProfileMigrator::CopySmartKeyword
rv = GetInteger(parser, section.get(), "Is post", &post);
if (NS_SUCCEEDED(rv) && post)
continue;
if (url.IsEmpty() || keyword.IsEmpty() || name.IsEmpty())
continue;
PRUint32 length = name.Length();
- PRInt32 index = 0;
+ PRInt32 index = 0;
do {
index = name.FindChar('&', index);
- if (index >= length - 2)
+ if ((PRUint32)index >= length - 2)
break;
// Assume "&&" is an escaped ampersand in the search query title.
if (name.CharAt(index + 1) == '&') {
name.Cut(index, 1);
index += 2;
continue;
}
name.Cut(index, 1);
}
- while (index < length);
+ while ((PRUint32)index < length);
nsCOMPtr<nsIURI> uri;
NS_NewURI(getter_AddRefs(uri), url.get());
if (!uri)
return NS_ERROR_OUT_OF_MEMORY;
nsCAutoString hostCStr;
uri->GetHost(hostCStr);
--- a/browser/components/migration/src/nsOperaProfileMigrator.h
+++ b/browser/components/migration/src/nsOperaProfileMigrator.h
@@ -69,20 +69,20 @@ public:
public:
typedef enum { STRING, INT, BOOL, COLOR } PrefType;
typedef nsresult(*prefConverter)(void*, nsIPrefBranch*);
struct PrefTransform {
- char* sectionName;
- char* keyName;
+ const char* sectionName;
+ const char* keyName;
PrefType type;
- char* targetPrefName;
+ const char* targetPrefName;
prefConverter prefSetterFunc;
PRBool prefHasValue;
union {
PRInt32 intValue;
PRBool boolValue;
char* stringValue;
};
};