mFoundPersonalToolbarFolder = aIsImportOperation;
mFoundPersonalToolbarFolder = PR_FALSE;
BookmarkParser::Init(nsIFile *aFile, nsIRDFDataSource *aDataSource,                      PRBool aIsImportOperation){    mDataSource = aDataSource;    mFoundIEFavoritesRoot = PR_FALSE;    mFoundPersonalToolbarFolder = aIsImportOperation;    mIsImportOperation = aIsImportOperation;    nsresult rv;    // determine default platform charset...    nsCOMPtr<nsIPlatformCharset> platformCharset =         do_GetService(kPlatformCharsetCID, &rv);    if (NS_SUCCEEDED(rv) && (platformCharset))    {        nsCAutoString    defaultCharset;        if (NS_SUCCEEDED(rv = platformCharset->GetCharset(kPlatformCharsetSel_4xBookmarkFile, defaultCharset)))        {            // found the default platform charset, now try and get a decoder from it to Unicode            nsCOMPtr<nsICharsetConverterManager> charsetConv =                 do_GetService(kCharsetConverterManagerCID, &rv);            if (NS_SUCCEEDED(rv) && (charsetConv))            {                rv = charsetConv->GetUnicodeDecoderRaw(defaultCharset.get(),                                                       getter_AddRefs(mUnicodeDecoder));            }        }    }    nsCAutoString   str;    BookmarkField   *field;    for (field = gBookmarkFieldTable; field->mName; ++field)    {        str = field->mPropertyName;        rv = gRDF->GetResource(str, &field->mProperty);        if (NS_FAILED(rv))  return rv;    }    for (field = gBookmarkHeaderFieldTable; field->mName; ++field)    {        str = field->mPropertyName;        rv = gRDF->GetResource(str, &field->mProperty);        if (NS_FAILED(rv))  return rv;    }    if (aFile)    {        PRInt64 contentsLen;        rv = aFile->GetFileSize(&contentsLen);        NS_ENSURE_SUCCESS(rv, rv);        if(LL_CMP(contentsLen, >, LL_INIT(0,0xFFFFFFFE)))            return NS_ERROR_FILE_TOO_BIG;        LL_L2UI(mContentsLen, contentsLen);        if (mContentsLen > 0)        {            mContents = new char [mContentsLen + 1];            if (mContents)            {                nsCOMPtr<nsIInputStream> inputStream;                rv = NS_NewLocalFileInputStream(getter_AddRefs(inputStream),                                                aFile,                                                PR_RDONLY,                                                -1, 0);                if (NS_FAILED(rv))                {                    delete [] mContents;                    mContents = nsnull;                }                else                {                    PRUint32 howMany;                    rv = inputStream->Read(mContents, mContentsLen, &howMany);                    if (NS_FAILED(rv))                    {                        delete [] mContents;                        mContents = nsnull;                        return NS_OK;                    }                    if (howMany == mContentsLen)                    {                        mContents[mContentsLen] = '\0';                    }                    else                    {                        delete [] mContents;                        mContents = nsnull;                    }                }                                }        }        if (!mContents)        {            // we were unable to read in the entire bookmark file at once,            // so let's try reading it in a bit at a time instead            rv = NS_NewLocalFileInputStream(getter_AddRefs(mInputStream),                                            aFile, PR_RDONLY, -1, 0);            NS_ENSURE_SUCCESS(rv, rv);        }    }    return NS_OK;}