This commit is contained in:
rjc%netscape.com 1999-06-26 07:40:59 +00:00
Родитель 6574c7355a
Коммит 44bb3754a6
2 изменённых файлов: 46 добавлений и 45 удалений

Просмотреть файл

@ -1,4 +1,4 @@
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4; c-file-style: "stroustrup" -*-
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8; c-file-style: "stroustrup" -*-
*
* The contents of this file are subject to the Netscape Public License
* Version 1.0 (the "NPL"); you may not use this file except in
@ -61,6 +61,8 @@ static NS_DEFINE_CID(kRDFServiceCID, NS_RDFSERVICE_CID);
static NS_DEFINE_CID(kRDFInMemoryDataSourceCID, NS_RDFINMEMORYDATASOURCE_CID);
static NS_DEFINE_IID(kISupportsIID, NS_ISUPPORTS_IID);
class FTPDataSourceCallback : public nsIStreamListener
{
private:
@ -202,7 +204,6 @@ public:
static nsIRDFService *gRDFService = nsnull;
static FTPDataSource *gFTPDataSource = nsnull;
@ -227,6 +228,7 @@ static const char kFTPprotocol[] = "ftp:";
static const char kFTPcommand[] = "http://home.netscape.com/NC-rdf#ftpcommand?";
static PRBool
isFTPURI(nsIRDFResource *r)
{
@ -634,6 +636,7 @@ FTPDataSourceCallback::OnStartBinding(nsIURI *aURL, const char *aContentType)
}
#ifndef NECKO
NS_IMETHODIMP
FTPDataSourceCallback::OnProgress(nsIURI* aURL, PRUint32 aProgress, PRUint32 aProgressMax)
@ -651,6 +654,7 @@ FTPDataSourceCallback::OnStatus(nsIURI* aURL, const PRUnichar* aMsg)
#endif
NS_IMETHODIMP
#ifdef NECKO
FTPDataSourceCallback::OnStopBinding(nsISupports *ctxt, nsresult status, const PRUnichar *errorMsg)
@ -674,6 +678,7 @@ FTPDataSourceCallback::OnStopBinding(nsIURI* aURL, nsresult aStatus, const PRUni
// stream listener methods
#ifndef NECKO
NS_IMETHODIMP
FTPDataSourceCallback::GetBindInfo(nsIURI* aURL, nsStreamBindingInfo* aInfo)
@ -683,6 +688,7 @@ FTPDataSourceCallback::GetBindInfo(nsIURI* aURL, nsStreamBindingInfo* aInfo)
#endif
NS_IMETHODIMP
#ifdef NECKO
FTPDataSourceCallback::OnDataAvailable(nsISupports *ctxt, nsIBufferInputStream *aIStream,
@ -811,6 +817,7 @@ FTPDataSourceCallback::QueryInterface(REFNSIID iid, void **result)
#endif
NS_METHOD
FTPDataSource::GetFTPListing(nsIRDFResource *source, nsISimpleEnumerator** aResult)
{
@ -919,6 +926,7 @@ FTPDataSource::Unassert(nsIRDFResource *source,
}
NS_IMETHODIMP
FTPDataSource::Change(nsIRDFResource* aSource,
nsIRDFResource* aProperty,
@ -929,6 +937,7 @@ FTPDataSource::Change(nsIRDFResource* aSource,
}
NS_IMETHODIMP
FTPDataSource::Move(nsIRDFResource* aOldSource,
nsIRDFResource* aNewSource,

Просмотреть файл

@ -1,4 +1,4 @@
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: t; c-basic-offset: 4; c-file-style: "stroustrup" -*-
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8; c-file-style: "stroustrup" -*-
*
* The contents of this file are subject to the Netscape Public License
* Version 1.0 (the "NPL"); you may not use this file except in
@ -263,6 +263,9 @@ nsIRDFResource *SearchDataSourceCallback::kNC_Site;
nsIRDFResource *SearchDataSourceCallback::kNC_Engine;
nsIRDFResource *SearchDataSourceCallback::kNC_loading;
static const char kEngineProtocol[] = "engine://";
static const char kSearchProtocol[] = "internetsearch:";
PRBool
@ -272,7 +275,7 @@ SearchDataSource::isEngineURI(nsIRDFResource *r)
nsXPIDLCString uri;
r->GetValue( getter_Copies(uri) );
if (!strncmp(uri, "engine://", 9))
if (!strncmp(uri, kEngineProtocol, sizeof(kEngineProtocol) - 1))
{
isEngineURIFlag = PR_TRUE;
}
@ -288,7 +291,7 @@ SearchDataSource::isSearchURI(nsIRDFResource *r)
nsXPIDLCString uri;
r->GetValue( getter_Copies(uri) );
if (!strncmp(uri, "internetsearch:", strlen("internetsearch:")))
if (!strncmp(uri, kSearchProtocol, sizeof(kSearchProtocol) - 1))
{
isSearchURIFlag = PR_TRUE;
}
@ -456,6 +459,7 @@ SearchDataSource::GetTarget(nsIRDFResource *source,
}
NS_IMETHODIMP
SearchDataSource::GetTargets(nsIRDFResource *source,
nsIRDFResource *property,
@ -536,6 +540,8 @@ SearchDataSource::Unassert(nsIRDFResource *source,
return NS_RDF_ASSERTION_REJECTED;
}
NS_IMETHODIMP
SearchDataSource::Change(nsIRDFResource* aSource,
nsIRDFResource* aProperty,
@ -546,6 +552,7 @@ SearchDataSource::Change(nsIRDFResource* aSource,
}
NS_IMETHODIMP
SearchDataSource::Move(nsIRDFResource* aOldSource,
nsIRDFResource* aNewSource,
@ -556,6 +563,7 @@ SearchDataSource::Move(nsIRDFResource* aOldSource,
}
NS_IMETHODIMP
SearchDataSource::HasAssertion(nsIRDFResource *source,
nsIRDFResource *property,
@ -589,7 +597,7 @@ SearchDataSource::HasAssertion(nsIRDFResource *source,
if (mInner)
{
mInner->HasAssertion(source, property, target, tv, hasAssertion);
rv = mInner->HasAssertion(source, property, target, tv, hasAssertion);
}
return(rv);
}
@ -785,7 +793,7 @@ SearchDataSource::BeginSearchRequest(nsIRDFResource *source)
{
if (attrib.EqualsIgnoreCase("engine"))
{
if (value.Find("engine://") == 0)
if (value.Find(kEngineProtocol) == 0)
{
char *val = value.ToNewCString();
if (val)
@ -862,9 +870,9 @@ SearchDataSource::DoSearch(nsIRDFResource *source, nsIRDFResource *engine, nsStr
if (NS_FAILED(rv = engine->GetValue(getter_Copies(engineURI))))
return(rv);
nsAutoString engineStr(engineURI);
if (engineStr.Find("engine://") != 0)
if (engineStr.Find(kEngineProtocol) != 0)
return(rv);
engineStr.Cut(0, strlen("engine://"));
engineStr.Cut(0, sizeof(kEngineProtocol) - 1);
char *basename = engineStr.ToNewCString();
if (!basename)
return(rv);
@ -1041,7 +1049,7 @@ SearchDataSource::GetSearchEngineList()
{
uri.Cut(0, separatorOffset+1);
nsAutoString searchURL("engine://");
nsAutoString searchURL(kEngineProtocol);
searchURL += uri;
char *basename = uri.ToNewCString();
@ -1063,18 +1071,6 @@ SearchDataSource::GetSearchEngineList()
{
mInner->Assert(kNC_SearchRoot, kNC_Child, searchRes, PR_TRUE);
#if 0
// Note: don't save file contents here. Save them when a sort actually begins.
// This means we use a lot less memory as we only save datasets that we are using.
// save file contents
nsCOMPtr<nsIRDFLiteral> dataLiteral;
if (NS_SUCCEEDED(rv = gRDFService->GetLiteral(data.GetUnicode(), getter_AddRefs(dataLiteral))))
{
mInner->Assert(searchRes, kNC_Data, dataLiteral, PR_TRUE);
}
#endif
// save name of search engine (as specified in file)
nsAutoString nameValue;
if (NS_SUCCEEDED(rv = GetData(data, "search", "name", nameValue)))
@ -1100,6 +1096,7 @@ SearchDataSource::GetSearchEngineList()
}
PRBool
SearchDataSource::isVisible(const nsNativeFileSpec& file)
{
@ -1176,7 +1173,6 @@ SearchDataSource::ReadFileContents(char *basename, nsString& sourceContents)
if (childURL != nsnull)
{
// be sure to resolve aliases in case we encounter one
CInfoPBRec cInfo;
PRBool wasAliased = PR_FALSE;
fileSpec.ResolveAlias(wasAliased);
nsAutoString childPath(childURL);
@ -1392,14 +1388,6 @@ SearchDataSource::GetInputs(nsString data, nsString text, nsString &input)
else
{
// if value attribute's "value" isn't quoted, get the first word... ?
/*
PRInt32 theEnd = line.FindCharInSet(" >\t", equal);
if (theEnd >= 0)
{
line.Mid(valueAttrib, equal+1, theEnd-equal-1);
valueAttrib.Trim(" \t");
}
*/
valueAttrib = line;
valueAttrib.Cut(0, equal+1);
valueAttrib = valueAttrib.Trim(" \t");
@ -1542,6 +1530,7 @@ SearchDataSourceCallback::OnStartBinding(nsIURI *aURL, const char *aContentType)
}
#ifndef NECKO
NS_IMETHODIMP
SearchDataSourceCallback::OnProgress(nsIURI* aURL, PRUint32 aProgress, PRUint32 aProgressMax)
@ -1559,6 +1548,7 @@ SearchDataSourceCallback::OnStatus(nsIURI* aURL, const PRUnichar* aMsg)
#endif
NS_IMETHODIMP
#ifdef NECKO
SearchDataSourceCallback::OnStopBinding(nsISupports *ctxt, nsresult status, const PRUnichar *errorMsg)
@ -2019,6 +2009,7 @@ SearchDataSourceCallback::OnStopBinding(nsIURI* aURL, nsresult aStatus, const PR
NS_IMPL_ISUPPORTS(SearchDataSourceCallback, nsIRDFSearchDataSourceCallback::GetIID());
#ifndef NECKO
NS_IMETHODIMP
SearchDataSourceCallback::GetBindInfo(nsIURI* aURL, nsStreamBindingInfo* aInfo)
@ -2028,6 +2019,7 @@ SearchDataSourceCallback::GetBindInfo(nsIURI* aURL, nsStreamBindingInfo* aInfo)
#endif
NS_IMETHODIMP
#ifdef NECKO
SearchDataSourceCallback::OnDataAvailable(nsISupports *ctxt, nsIBufferInputStream *aIStream,