Backout bug 299992 - too much odd platform-specific bustage

This commit is contained in:
bsmedberg@covad.net
2005-08-11 22:07:08 +00:00
parent f3408cc965
commit 44a6531d52
41 changed files with 2750 additions and 903 deletions

View File

@@ -71,6 +71,7 @@ CPPSRCS = nsProfileMigrator.cpp \
nsNetscapeProfileMigratorBase.cpp \
nsSeamonkeyProfileMigrator.cpp \
nsPhoenixProfileMigrator.cpp \
nsINIParser.cpp \
$(NULL)
ifneq ($(OS_ARCH),BeOS)

View File

@@ -0,0 +1,332 @@
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla Public License Version
* 1.1 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is Mozilla Communicator client code, released
* March 31, 1998.
*
* The Initial Developer of the Original Code is
* Netscape Communications Corporation.
* Portions created by the Initial Developer are Copyright (C) 1998
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
* Samir Gehani <sgehani@netscape.com>
*
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the MPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
#include "nsINIParser.h"
#include "nsCRT.h"
nsINIParser::nsINIParser(const char *aFilename)
{
FILE *fd = NULL;
long eofpos = 0;
int rd = 0;
mFileBuf = NULL;
mFileBufSize = 0;
mError = OK;
DUMP("nsINIParser");
/* param check */
if (!aFilename)
{
mError = E_PARAM;
return;
}
/* open the file */
fd = fopen(aFilename, "r");
if (!fd)
goto bail;
/* get file size */
if (fseek(fd, 0, SEEK_END) != 0)
goto bail;
eofpos = ftell(fd);
if (eofpos == 0)
goto bail;
/* malloc an internal buf the size of the file */
mFileBuf = (char *) malloc((eofpos+1) * sizeof(char));
if (!mFileBuf)
{
mError = E_MEM;
return;
}
mFileBufSize = eofpos;
/* read the file in one swoop */
if (fseek(fd, 0, SEEK_SET) != 0)
goto bail;
rd = fread((void *)mFileBuf, 1, eofpos, fd);
if (!rd)
goto bail;
mFileBuf[mFileBufSize] = '\0';
/* close file */
fclose(fd);
return;
bail:
mError = E_READ;
return;
}
nsINIParser::~nsINIParser()
{
if (mFileBuf) {
nsCRT::free(mFileBuf);
mFileBuf = nsnull;
}
DUMP("~nsINIParser");
}
int
nsINIParser::GetString( char *aSection, char *aKey,
char *aValBuf, int *aIOValBufSize )
{
char *secPtr = NULL;
mError = OK;
DUMP("GetString");
/* param check */
if ( !aSection || !aKey || !aValBuf ||
!aIOValBufSize || (*aIOValBufSize <= 0) )
return E_PARAM;
/* find the section if it exists */
mError = FindSection(aSection, &secPtr);
if (mError != OK)
return mError;
/* find the key if it exists in the valid section we found */
mError = FindKey(secPtr, aKey, aValBuf, aIOValBufSize);
return mError;
}
int
nsINIParser::GetStringAlloc( char *aSection, char *aKey,
char **aOutBuf, int *aOutBufSize )
{
char buf[MAX_VAL_SIZE];
int bufsize = MAX_VAL_SIZE;
mError = OK;
DUMP("GetStringAlloc");
mError = GetString(aSection, aKey, buf, &bufsize);
if (mError != OK)
return mError;
*aOutBuf = (char *) malloc(bufsize + 1);
strncpy(*aOutBuf, buf, bufsize);
*(*aOutBuf + bufsize) = 0;
*aOutBufSize = bufsize + 1;
return mError;
}
int
nsINIParser::GetError()
{
DUMP("GetError");
return mError;
}
char *
nsINIParser::ResolveName(char *aINIRoot)
{
char *resolved = NULL;
char *locale = NULL;
struct stat st_exists;
/* param check */
if (!aINIRoot)
return NULL;
locale = setlocale(LC_CTYPE, NULL);
if (!locale)
return NULL;
/* resolved string: "<root>.ini.<locale>\0" */
resolved = (char *) malloc(strlen(aINIRoot) + 5 + strlen(locale) + 1);
if (!resolved)
return NULL;
/* locale specific ini file name */
sprintf(resolved, "%s.ini.%s", aINIRoot, locale);
if (0 == stat(resolved, &st_exists))
return resolved;
/* fallback to general ini file name */
sprintf(resolved, "%s.ini", aINIRoot);
if (0 == stat(resolved, &st_exists))
return resolved;
/* neither existed so error returned */
return NULL;
}
int
nsINIParser::FindSection(char *aSection, char **aOutSecPtr)
{
char *currChar = mFileBuf;
char *nextSec = NULL;
char *secClose = NULL;
char *nextNL = NULL;
mError = E_NO_SEC;
DUMP("FindSection");
// param check
if (!aSection || !aOutSecPtr)
{
mError = E_PARAM;
return mError;
}
while (currChar < (mFileBuf + mFileBufSize))
{
// look for first '['
nextSec = NULL;
nextSec = strchr(currChar, '[');
if (!nextSec)
break;
currChar = nextSec + 1;
// extract section name till first ']'
secClose = NULL; nextNL = NULL;
secClose = strchr(currChar, ']');
nextNL = strchr(currChar, NL);
if ((!nextNL) || (nextNL < secClose))
{
currChar = nextNL;
continue;
}
// if section name matches we succeeded
if (strncmp(aSection, currChar, strlen(aSection)) == 0)
{
*aOutSecPtr = secClose + 1;
mError = OK;
break;
}
}
return mError;
}
int
nsINIParser::FindKey(char *aSecPtr, char *aKey, char *aVal, int *aIOValSize)
{
char *nextNL = NULL;
char *secEnd = NULL;
char *currLine = aSecPtr;
char *nextEq = NULL;
mError = E_NO_KEY;
DUMP("FindKey");
// param check
if (!aSecPtr || !aKey || !aVal || !aIOValSize || (*aIOValSize <= 0))
{
mError = E_PARAM;
return mError;
}
// determine the section end
secEnd = aSecPtr;
find_end:
if (secEnd)
secEnd = strchr(secEnd, '['); // search for next sec start
if (!secEnd)
{
secEnd = strchr(aSecPtr, '\0'); // else search for file end
if (!secEnd)
{
mError = E_SEC_CORRUPT; // else this data is corrupt
return mError;
}
}
// handle start section token ('[') in values for i18n
if (*secEnd == '[' && !(secEnd == aSecPtr || *(secEnd-1) == NL))
{
secEnd++;
goto find_end;
}
while (currLine < secEnd)
{
nextNL = NULL;
nextNL = strchr(currLine, NL);
if (!nextNL)
nextNL = mFileBuf + mFileBufSize;
// ignore commented lines (starting with ;)
if (currLine == strchr(currLine, ';'))
{
currLine = nextNL + 1;
continue;
}
// extract key before '='
nextEq = NULL;
nextEq = strchr(currLine, '=');
if (!nextEq || nextEq > nextNL)
{
currLine = nextNL + 1;
continue;
}
// if key matches we succeeded
if (strncmp(currLine, aKey, strlen(aKey)) == 0)
{
// extract the value and return
if (*aIOValSize < nextNL - nextEq)
{
mError = E_SMALL_BUF;
*aVal = '\0';
*aIOValSize = 0;
return mError;
}
*aIOValSize = nextNL - (nextEq + 1);
strncpy(aVal, (nextEq + 1), *aIOValSize);
*(aVal + *aIOValSize) = 0; // null terminate
mError = OK;
return mError;
}
else
{
currLine = nextNL + 1;
}
}
return mError;
}

View File

@@ -0,0 +1,163 @@
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla Public License Version
* 1.1 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is Mozilla Communicator client code, released
* March 31, 1998.
*
* The Initial Developer of the Original Code is
* Netscape Communications Corporation.
* Portions created by the Initial Developer are Copyright (C) 1998
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
* Samir Gehani <sgehani@netscape.com>
*
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the MPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
#ifndef _NS_INIPARSER_H_
#define _NS_INIPARSER_H_
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <sys/stat.h>
#include <locale.h>
class nsINIParser
{
public:
/**
* nsINIParser
*
* Construct a new INI parser for the file specified.
*
* @param aFilename path to INI file
*/
nsINIParser(const char *aFilename);
~nsINIParser();
/**
* GetString
*
* Gets the value of the specified key in the specified section
* of the INI file represented by this instance. The value is stored
* in the supplied buffer. The buffer size is provided as input and
* the actual bytes used by the value is set in the in/out size param.
*
* @param aSection section name
* @param aKey key name
* @param aValBuf user supplied buffer
* @param aIOValBufSize buf size on input; actual buf used on output
*
* @return mError operation success code
*/
int GetString( char *aSection, char *aKey,
char *aValBuf, int *aIOValBufSize );
/**
* GetStringAlloc
*
* Same as GetString() except the buffer is allocated to the exact
* size of the value. Useful when the buffer is allocated everytime
* rather than reusing the same buffer when calling this function
* multiple times.
*
* @param aSection section name
* @param aKey key name
* @param aOutBuf buffer to be allocated
* @param aOutBufSize size of newly allocated buffer
*
* @return mError operation success code
*/
int GetStringAlloc( char *aSection, char *aKey,
char **aOutBuf, int *aOutBufSize );
/**
* GetError
*
* Exposes the last error on this instance. Useful for checking
* the state of the object after construction since the INI file
* is parsed once at object-allocation time.
*
* @return mError last error on ops on this object
*/
int GetError();
/**
* ResolveName
*
* Given a "root" name we append the runtime locale of the
* current system to the <root>.ini. If such a file exists we
* return this as the name else simply return <root>.ini.
*
* NOTE: Returned string is allocated and caller is responsible
* ---- for its deallocation.
*
* @param aINIRoot the "root" of the INI file name
* @return resolved the resolved INI file name
* (NULL if neither exist)
*/
static char *ResolveName(char *aINIRoot);
/*--------------------------------------------------------------------*
* Errors
*--------------------------------------------------------------------*/
enum
{
OK = 0,
E_READ = -701,
E_MEM = -702,
E_PARAM = -703,
E_NO_SEC = -704,
E_NO_KEY = -705,
E_SEC_CORRUPT = -706,
E_SMALL_BUF = -707
};
private:
int FindSection(char *aSection, char **aOutSecPtr);
int FindKey(char *aSecPtr, char *aKey, char *aVal, int *aIOValSize);
char *mFileBuf;
int mFileBufSize;
int mError;
};
#define NL '\n'
#define MAX_VAL_SIZE 512
#if defined(DUMP)
#undef DUMP
#endif
#if defined(DEBUG_sgehani) || defined(DEBUG_druidd) || defined(DEBUG_root)
#define DUMP(_msg) printf("%s %d: %s \n", __FILE__, __LINE__, _msg);
#else
#define DUMP(_msg)
#endif
#endif /*_NS_INIPARSER_H_ */

View File

@@ -367,18 +367,15 @@ nsOperaProfileMigrator::SetString(void* aTransform, nsIPrefBranch* aBranch)
nsresult
nsOperaProfileMigrator::CopyPreferences(PRBool aReplace)
{
nsresult rv;
nsCOMPtr<nsIFile> operaPrefs;
mOperaProfile->Clone(getter_AddRefs(operaPrefs));
operaPrefs->Append(OPERA_PREFERENCES_FILE_NAME);
nsCOMPtr<nsILocalFile> lf(do_QueryInterface(operaPrefs));
NS_ENSURE_TRUE(lf, NS_ERROR_UNEXPECTED);
nsINIParser parser;
rv = parser.Init(lf);
NS_ENSURE_SUCCESS(rv, rv);
nsCAutoString path;
operaPrefs->GetNativePath(path);
nsINIParser* parser = new nsINIParser(path.get());
if (!parser)
return NS_ERROR_OUT_OF_MEMORY;
nsCOMPtr<nsIPrefBranch> branch(do_GetService(NS_PREFSERVICE_CONTRACTID));
@@ -386,6 +383,7 @@ nsOperaProfileMigrator::CopyPreferences(PRBool aReplace)
PrefTransform* transform;
PrefTransform* end = gTransforms + sizeof(gTransforms)/sizeof(PrefTransform);
PRInt32 length;
char* lastSectionName = nsnull;
for (transform = gTransforms; transform < end; ++transform) {
if (transform->sectionName)
@@ -404,22 +402,22 @@ nsOperaProfileMigrator::CopyPreferences(PRBool aReplace)
nsCRT::free(colorString);
}
else {
nsCAutoString val;
rv = parser.GetString(lastSectionName,
transform->keyName,
val);
if (NS_SUCCEEDED(rv)) {
nsXPIDLCString val;
PRInt32 err = parser->GetStringAlloc(lastSectionName, transform->keyName, getter_Copies(val), &length);
if (err == nsINIParser::OK) {
PRInt32 strerr;
switch (transform->type) {
case _OPM(STRING):
transform->stringValue = ToNewCString(val);
break;
case _OPM(INT): {
transform->intValue = val.ToInteger(&strerr);
nsCAutoString valStr; valStr = val;
transform->intValue = valStr.ToInteger(&strerr);
}
break;
case _OPM(BOOL): {
transform->boolValue = val.ToInteger(&strerr) != 0;
nsCAutoString valStr; valStr = val;
transform->boolValue = valStr.ToInteger(&strerr) != 0;
}
break;
default:
@@ -442,22 +440,23 @@ nsOperaProfileMigrator::CopyPreferences(PRBool aReplace)
if (aReplace)
CopyUserContentSheet(parser);
delete parser;
parser = nsnull;
return NS_OK;
}
nsresult
nsOperaProfileMigrator::CopyProxySettings(nsINIParser &aParser,
nsOperaProfileMigrator::CopyProxySettings(nsINIParser* aParser,
nsIPrefBranch* aBranch)
{
nsresult rv;
PRInt32 networkProxyType = 0;
const char* protocols[4] = { "HTTP", "HTTPS", "FTP", "GOPHER" };
const char* protocols_l[4] = { "http", "https", "ftp", "gopher" };
char toggleBuf[15], serverBuf[20], serverPrefBuf[20],
serverPortPrefBuf[25];
PRInt32 enabled;
PRInt32 length, err, enabled;
for (PRUint32 i = 0; i < 4; ++i) {
sprintf(toggleBuf, "Use %s", protocols[i]);
GetInteger(aParser, "Proxy", toggleBuf, &enabled);
@@ -468,9 +467,9 @@ nsOperaProfileMigrator::CopyProxySettings(nsINIParser &aParser,
}
sprintf(serverBuf, "%s Server", protocols[i]);
nsCAutoString proxyServer;
rv = aParser.GetString("Proxy", serverBuf, proxyServer);
if (NS_FAILED(rv))
nsXPIDLCString proxyServer;
err = aParser->GetStringAlloc("Proxy", serverBuf, getter_Copies(proxyServer), &length);
if (err != nsINIParser::OK)
continue;
sprintf(serverPrefBuf, "network.proxy.%s", protocols_l[i]);
@@ -481,18 +480,16 @@ nsOperaProfileMigrator::CopyProxySettings(nsINIParser &aParser,
GetInteger(aParser, "Proxy", "Use Automatic Proxy Configuration", &enabled);
if (enabled)
networkProxyType = 2;
nsCAutoString configURL;
rv = aParser.GetString("Proxy", "Automatic Proxy Configuration URL",
configURL);
if (NS_SUCCEEDED(rv))
aBranch->SetCharPref("network.proxy.autoconfig_url", configURL.get());
nsXPIDLCString configURL;
err = aParser->GetStringAlloc("Proxy", "Automatic Proxy Configuration URL", getter_Copies(configURL), &length);
if (err == nsINIParser::OK)
aBranch->SetCharPref("network.proxy.autoconfig_url", configURL);
GetInteger(aParser, "Proxy", "No Proxy Servers Check", &enabled);
if (enabled) {
nsCAutoString servers;
rv = aParser.GetString("Proxy", "No Proxy Servers", servers);
if (NS_SUCCEEDED(rv))
nsXPIDLCString servers;
err = aParser->GetStringAlloc("Proxy", "No Proxy Servers", getter_Copies(servers), &length);
if (err == nsINIParser::OK)
ParseOverrideServers(servers.get(), aBranch);
}
@@ -502,26 +499,28 @@ nsOperaProfileMigrator::CopyProxySettings(nsINIParser &aParser,
}
nsresult
nsOperaProfileMigrator::GetInteger(nsINIParser &aParser,
nsOperaProfileMigrator::GetInteger(nsINIParser* aParser,
char* aSectionName,
char* aKeyName,
PRInt32* aResult)
{
nsCAutoString val;
char val[20];
PRInt32 length = 20;
nsresult rv = aParser.GetString(aSectionName, aKeyName, val);
if (NS_FAILED(rv))
return rv;
PRInt32 err = aParser->GetString(aSectionName, aKeyName, val, &length);
if (err != nsINIParser::OK)
return NS_ERROR_FAILURE;
*aResult = val.ToInteger((PRInt32*) &rv);
nsCAutoString valueStr((char*)val);
PRInt32 stringErr;
*aResult = valueStr.ToInteger(&stringErr);
return rv;
return NS_OK;
}
nsresult
nsOperaProfileMigrator::ParseColor(nsINIParser &aParser,
char* aSectionName, char** aResult)
nsOperaProfileMigrator::ParseColor(nsINIParser* aParser, char* aSectionName, char** aResult)
{
nsresult rv;
PRInt32 r, g, b;
@@ -542,37 +541,34 @@ nsOperaProfileMigrator::ParseColor(nsINIParser &aParser,
}
nsresult
nsOperaProfileMigrator::CopyUserContentSheet(nsINIParser &aParser)
nsOperaProfileMigrator::CopyUserContentSheet(nsINIParser* aParser)
{
nsresult rv;
nsresult rv = NS_OK;
nsCAutoString userContentCSS;
rv = aParser.GetString("User Prefs", "Local CSS File", userContentCSS);
if (NS_FAILED(rv) || userContentCSS.Length() == 0)
return NS_OK;
nsXPIDLCString userContentCSS;
PRInt32 size;
PRInt32 err = aParser->GetStringAlloc("User Prefs", "Local CSS File", getter_Copies(userContentCSS), &size);
if (err == nsINIParser::OK && userContentCSS.Length() > 0) {
// Copy the file
nsCOMPtr<nsILocalFile> userContentCSSFile(do_CreateInstance("@mozilla.org/file/local;1"));
if (!userContentCSSFile)
return NS_ERROR_OUT_OF_MEMORY;
// Copy the file
nsCOMPtr<nsILocalFile> userContentCSSFile;
rv = NS_NewNativeLocalFile(userContentCSS, PR_TRUE,
getter_AddRefs(userContentCSSFile));
if (NS_FAILED(rv))
return NS_OK;
userContentCSSFile->InitWithNativePath(userContentCSS);
PRBool exists;
userContentCSSFile->Exists(&exists);
if (!exists)
return NS_OK;
PRBool exists;
rv = userContentCSSFile->Exists(&exists);
if (NS_FAILED(rv) || !exists)
return NS_OK;
nsCOMPtr<nsIFile> profileChromeDir;
NS_GetSpecialDirectory(NS_APP_USER_CHROME_DIR,
getter_AddRefs(profileChromeDir));
if (!profileChromeDir)
return NS_ERROR_OUT_OF_MEMORY;
nsCOMPtr<nsIFile> profileChromeDir;
NS_GetSpecialDirectory(NS_APP_USER_CHROME_DIR,
getter_AddRefs(profileChromeDir));
if (!profileChromeDir)
return NS_OK;
userContentCSSFile->CopyToNative(profileChromeDir,
NS_LITERAL_CSTRING("userContent.css"));
return NS_OK;
rv = userContentCSSFile->CopyToNative(profileChromeDir, nsDependentCString("userContent.css"));
}
return rv;
}
nsresult
@@ -1055,20 +1051,17 @@ nsOperaProfileMigrator::CopySmartKeywords(nsIBookmarksService* aBMS,
nsIStringBundle* aBundle,
nsIRDFResource* aParentFolder)
{
nsresult rv;
nsresult rv = NS_OK;
nsCOMPtr<nsIFile> smartKeywords;
mOperaProfile->Clone(getter_AddRefs(smartKeywords));
smartKeywords->Append(NS_LITERAL_STRING("search.ini"));
nsCOMPtr<nsILocalFile> lf(do_QueryInterface(smartKeywords));
if (!lf)
return NS_OK;
nsINIParser parser;
rv = parser.Init(lf);
if (NS_FAILED(rv))
return NS_OK;
nsCAutoString path;
smartKeywords->GetNativePath(path);
nsINIParser* parser = new nsINIParser(path.get());
if (!parser)
return NS_ERROR_OUT_OF_MEMORY;
nsXPIDLString sourceNameOpera;
aBundle->GetStringFromName(NS_LITERAL_STRING("sourceNameOpera").get(),
@@ -1085,32 +1078,31 @@ nsOperaProfileMigrator::CopySmartKeywords(nsIBookmarksService* aBMS,
aParentFolder, -1, getter_AddRefs(keywordsFolder));
PRInt32 sectionIndex = 1;
nsCAutoString name, url, keyword;
char section[35];
nsXPIDLCString name, url, keyword;
PRInt32 keyValueLength = 0;
do {
nsCAutoString section("Search Engine ");
section.AppendInt(sectionIndex++);
rv = parser.GetString(section.get(), "Name", name);
if (NS_FAILED(rv))
sprintf(section, "Search Engine %d", sectionIndex++);
PRInt32 err = parser->GetStringAlloc(section, "Name", getter_Copies(name), &keyValueLength);
if (err != nsINIParser::OK)
break;
rv = parser.GetString(section.get(), "URL", url);
if (NS_FAILED(rv))
err = parser->GetStringAlloc(section, "URL", getter_Copies(url), &keyValueLength);
if (err != nsINIParser::OK)
continue;
rv = parser.GetString(section.get(), "Key", keyword);
if (NS_FAILED(rv))
err = parser->GetStringAlloc(section, "Key", getter_Copies(keyword), &keyValueLength);
if (err != nsINIParser::OK)
continue;
PRInt32 post;
rv = GetInteger(parser, section.get(), "Is post", &post);
if (NS_SUCCEEDED(rv) && post)
err = GetInteger(parser, section, "Is post", &post);
if (post)
continue;
if (url.IsEmpty() || keyword.IsEmpty() || name.IsEmpty())
continue;
NS_ConvertUTF8toUCS2 nameStr(name);
nsAutoString nameStr; nameStr.Assign(NS_ConvertUTF8toUCS2(name));
PRUint32 length = nameStr.Length();
PRInt32 index = 0;
do {
@@ -1160,6 +1152,11 @@ nsOperaProfileMigrator::CopySmartKeywords(nsIBookmarksService* aBMS,
}
while (1);
if (parser) {
delete parser;
parser = nsnull;
}
return rv;
}
#endif

View File

@@ -92,10 +92,10 @@ public:
protected:
nsresult CopyPreferences(PRBool aReplace);
nsresult ParseColor(nsINIParser &aParser, char* aSectionName, char** aResult);
nsresult CopyUserContentSheet(nsINIParser &aParser);
nsresult CopyProxySettings(nsINIParser &aParser, nsIPrefBranch* aBranch);
nsresult GetInteger(nsINIParser &aParser, char* aSectionName,
nsresult ParseColor(nsINIParser* aParser, char* aSectionName, char** aResult);
nsresult CopyUserContentSheet(nsINIParser* aParser);
nsresult CopyProxySettings(nsINIParser* aParser, nsIPrefBranch* aBranch);
nsresult GetInteger(nsINIParser* aParser, char* aSectionName,
char* aKeyName, PRInt32* aResult);
nsresult CopyCookies(PRBool aReplace);