From 2675381a3507f23b2fefb813b5fd2281f02aa82b Mon Sep 17 00:00:00 2001 From: "warren%netscape.com" Date: Thu, 6 Sep 2007 21:57:47 +0000 Subject: [PATCH] Bug 47207. Backing out logging/PRINTF changes until we can fix stopwatch.h, introduce double parens, etc. --- suite/browser/src/nsInternetSearchService.cpp | 74 +++++++++---------- suite/browser/src/nsLocalSearchService.cpp | 9 +-- 2 files changed, 38 insertions(+), 45 deletions(-) diff --git a/suite/browser/src/nsInternetSearchService.cpp b/suite/browser/src/nsInternetSearchService.cpp index 86a5e2d51a8..58f6c7d10d9 100755 --- a/suite/browser/src/nsInternetSearchService.cpp +++ b/suite/browser/src/nsInternetSearchService.cpp @@ -72,12 +72,6 @@ #include "winbase.h" #endif -#include "nslog.h" - -NS_IMPL_LOG(nsInternetSearchServiceLog) -#define PRINTF NS_LOG_PRINTF(nsInternetSearchServiceLog) -#define FLUSH NS_LOG_FLUSH(nsInternetSearchServiceLog) - #ifdef DEBUG // #define DEBUG_SEARCH_OUTPUT 1 // #define DEBUG_SEARCH_UPDATES 1 @@ -302,7 +296,9 @@ searchModePrefCallback(const char *pref, void *aClosure) { PRInt32 searchMode=0; searchDS->prefs->GetIntPref(pref, &searchMode); - PRINTF("searchModePrefCallback: '%s' = %d\n", pref, searchMode); +#ifdef DEBUG + printf("searchModePrefCallback: '%s' = %d\n", pref, searchMode); +#endif searchDS->Assert(searchDS->kNC_LastSearchRoot, searchDS->kNC_LastSearchMode, searchDS->kTrueLiteral, PR_TRUE); } return(NS_OK); @@ -641,7 +637,7 @@ InternetSearchDataSource::FireTimer(nsITimer* aTimer, void* aClosure) search->busySchedule = TRUE; #ifdef DEBUG_SEARCH_UPDATES - PRINTF(" InternetSearchDataSource::FireTimer - Pinging '%s'\n", (char *)updateURL); + printf(" InternetSearchDataSource::FireTimer - Pinging '%s'\n", (char *)updateURL); #endif } @@ -649,7 +645,7 @@ InternetSearchDataSource::FireTimer(nsITimer* aTimer, void* aClosure) #ifdef DEBUG_SEARCH_UPDATES else { - PRINTF(" InternetSearchDataSource::FireTimer - busy pinging.\n"); + printf(" InternetSearchDataSource::FireTimer - busy pinging.\n"); } #endif @@ -1286,8 +1282,8 @@ InternetSearchDataSource::GetCategoryList() aEngineRes->GetValueConst(&catEngineURI); if (catEngineURI) { - PRINTF("**** Stale search engine reference to '%s'\n", - catEngineURI); + printf("**** Stale search engine reference to '%s'\n", + catEngineURI); } #endif nsCOMPtr staleCatEngine; @@ -2177,7 +2173,7 @@ InternetSearchDataSource::AddSearchEngine(const char *engineURL, const char *ico // can be null or empty strings, which is OK #ifdef DEBUG_SEARCH_OUTPUT - PRINTF("AddSearchEngine: engine='%s'\n", engineURL); + printf("AddSearchEngine: engine='%s'\n", engineURL); #endif nsresult rv = NS_OK; @@ -2625,8 +2621,8 @@ InternetSearchDataSource::FindInternetSearchResults(const char *url, PRBool *sea char *engineMatch = searchText.ToNewCString(); if (engineMatch) { - PRINTF("FindInternetSearchResults: search for: '%s'\n\n", - engineMatch); + printf("FindInternetSearchResults: search for: '%s'\n\n", + engineMatch); Recycle(engineMatch); engineMatch = nsnull; } @@ -2933,7 +2929,7 @@ InternetSearchDataSource::BeginSearchRequest(nsIRDFResource *source, PRBool doNe if (!baseFilename) continue; #ifdef DEBUG_SEARCH_OUTPUT - PRINTF("Search engine to query: '%s'\n", baseFilename); + printf("Search engine to query: '%s'\n", baseFilename); #endif nsCOMPtr engine; @@ -3024,7 +3020,7 @@ InternetSearchDataSource::FindData(nsIRDFResource *engine, nsIRDFLiteral **dataL return(rv); #ifdef DEBUG_SEARCH_OUTPUT - PRINTF("InternetSearchDataSource::FindData - reading in '%s'\n", baseFilename); + printf("InternetSearchDataSource::FindData - reading in '%s'\n", baseFilename); #endif nsFileSpec engineSpec(baseFilename); @@ -3333,7 +3329,7 @@ InternetSearchDataSource::validateEngine(nsIRDFResource *engine) validateEngineNow(engine); #ifdef DEBUG_SEARCH_UPDATES - PRINTF(" Search engine '%s' marked valid as of now.\n", engineURI); + printf(" Search engine '%s' marked valid as of now.\n", engineURI); #endif return(NS_OK); @@ -3356,8 +3352,8 @@ InternetSearchDataSource::validateEngine(nsIRDFResource *engine) if (durationSecs < updateCheckSecs) { #ifdef DEBUG_SEARCH_UPDATES - PRINTF(" Search engine '%s' is valid for %d more seconds.\n", - engineURI, (updateCheckSecs-durationSecs)); + printf(" Search engine '%s' is valid for %d more seconds.\n", + engineURI, (updateCheckSecs-durationSecs)); #endif return(NS_OK); } @@ -3369,15 +3365,15 @@ InternetSearchDataSource::validateEngine(nsIRDFResource *engine) mUpdateArray->AppendElement(engine); #ifdef DEBUG_SEARCH_UPDATES - PRINTF(" Search engine '%s' is now queued to be validated via HTTP HEAD method.\n", - engineURI, durationSecs); + printf(" Search engine '%s' is now queued to be validated via HTTP HEAD method.\n", + engineURI, durationSecs); #endif } else { #ifdef DEBUG_SEARCH_UPDATES - PRINTF(" Search engine '%s' is already in queue to be validated.\n", - engineURI); + printf(" Search engine '%s' is already in queue to be validated.\n", + engineURI); #endif } return(NS_OK); @@ -4280,7 +4276,7 @@ NS_IMETHODIMP InternetSearchDataSource::OnStartRequest(nsIChannel* channel, nsISupports *ctxt) { #ifdef DEBUG_SEARCH_OUTPUT - PRINTF("InternetSearchDataSourceCallback::OnStartRequest entered.\n"); + printf("InternetSearchDataSourceCallback::OnStartRequest entered.\n"); #endif return(NS_OK); } @@ -4306,7 +4302,7 @@ InternetSearchDataSource::OnDataAvailable(nsIChannel* channel, nsISupports *ctxt if (NS_FAILED(rv = aIStream->Read(buffer, aLength, &count)) || count == 0) { #ifdef DEBUG - PRINTF("Search datasource read failure.\n"); + printf("Search datasource read failure.\n"); #endif delete []buffer; return(rv); @@ -4314,7 +4310,7 @@ InternetSearchDataSource::OnDataAvailable(nsIChannel* channel, nsISupports *ctxt if (count != aLength) { #ifdef DEBUG - PRINTF("Search datasource read # of bytes failure.\n"); + printf("Search datasource read # of bytes failure.\n"); #endif delete []buffer; return(NS_ERROR_UNEXPECTED); @@ -4466,7 +4462,7 @@ InternetSearchDataSource::OnStopRequest(nsIChannel* channel, nsISupports *ctxt, if (val) { #ifdef DEBUG_SEARCH_UPDATES - PRINTF(" Search engine='%s' Last-Modified='%s'\n", engineURI, val); + printf(" Search engine='%s' Last-Modified='%s'\n", engineURI, val); #endif lastModValue = val; nsCRT::free(val); @@ -4478,7 +4474,7 @@ InternetSearchDataSource::OnStopRequest(nsIChannel* channel, nsISupports *ctxt, if (val) { #ifdef DEBUG_SEARCH_UPDATES - PRINTF(" Search engine='%s' Content-Length='%s'\n", engineURI, val); + printf(" Search engine='%s' Content-Length='%s'\n", engineURI, val); #endif contentLengthValue = val; nsCRT::free(val); @@ -4527,15 +4523,15 @@ InternetSearchDataSource::OnStopRequest(nsIChannel* channel, nsISupports *ctxt, nsAutoString dataStr(dataUni); PRInt32 dataLen=dataStr.Length(); #ifdef DEBUG_SEARCH_UPDATES - PRINTF(" Search engine='%s' data length='%d'\n", engineURI, dataLen); + printf(" Search engine='%s' data length='%d'\n", engineURI, dataLen); #endif PRInt32 contentLen=0, err=0; contentLen = contentLengthValue.ToInteger(&err); if ((!err) && (dataLen != contentLen)) { #ifdef DEBUG_SEARCH_UPDATES - PRINTF(" Search engine '%s' data length != remote content length, so update\n", - engineURI, dataLen); + printf(" Search engine '%s' data length != remote content length, so update\n", + engineURI, dataLen); #endif updateSearchEngineFile = PR_TRUE; } @@ -4550,7 +4546,7 @@ InternetSearchDataSource::OnStopRequest(nsIChannel* channel, nsISupports *ctxt, if (updateSearchEngineFile == PR_TRUE) { #ifdef DEBUG_SEARCH_UPDATES - PRINTF(" Search engine='%s' needs updating, so fetching it\n", engineURI); + printf(" Search engine='%s' needs updating, so fetching it\n", engineURI); #endif // get update URL nsCString updateURL; @@ -4593,7 +4589,7 @@ InternetSearchDataSource::OnStopRequest(nsIChannel* channel, nsISupports *ctxt, else { #ifdef DEBUG_SEARCH_UPDATES - PRINTF(" Search engine='%s' is current and requires no updating\n", engineURI); + printf(" Search engine='%s' is current and requires no updating\n", engineURI); #endif } } @@ -4684,7 +4680,7 @@ InternetSearchDataSource::webSearchFinalize(nsIChannel* channel, nsIInternetSear else { #ifdef DEBUG_SEARCH_OUTPUT - PRINTF(" *** InternetSearchDataSourceCallback::OnStopRequest: no data.\n\n"); + printf(" *** InternetSearchDataSourceCallback::OnStopRequest: no data.\n\n"); #endif } @@ -4932,7 +4928,7 @@ InternetSearchDataSource::ParseHTML(nsIURI *aURL, nsIRDFResource *mParent, nsIRD char *results = resultItem.ToNewCString(); if (results) { - PRINTF("\n----- Search result: '%s'\n\n", results); + printf("\n----- Search result: '%s'\n\n", results); nsCRT::free(results); results = nsnull; } @@ -4943,7 +4939,7 @@ InternetSearchDataSource::ParseHTML(nsIURI *aURL, nsIRDFResource *mParent, nsIRD if (hrefOffset < 0) { #ifdef DEBUG_SEARCH_OUTPUT - PRINTF("\n***** Unable to find HREF!\n\n"); + printf("\n***** Unable to find HREF!\n\n"); #endif continue; } @@ -5034,7 +5030,7 @@ InternetSearchDataSource::ParseHTML(nsIURI *aURL, nsIRDFResource *mParent, nsIRD nsAutoString site(hrefStr); #ifdef DEBUG_SEARCH_OUTPUT - PRINTF("HREF: '%s'\n", href); + printf("HREF: '%s'\n", href); #endif nsCOMPtr res; @@ -5138,7 +5134,7 @@ InternetSearchDataSource::ParseHTML(nsIURI *aURL, nsIRDFResource *mParent, nsIRD if (anchorEnd < quoteEndOffset) { #ifdef DEBUG_SEARCH_OUTPUT - PRINTF("\n\nSearch: Unable to find ending > when computing name.\n\n"); + printf("\n\nSearch: Unable to find ending > when computing name.\n\n"); #endif continue; } @@ -5146,7 +5142,7 @@ InternetSearchDataSource::ParseHTML(nsIURI *aURL, nsIRDFResource *mParent, nsIRD if (anchorStop < anchorEnd) { #ifdef DEBUG_SEARCH_OUTPUT - PRINTF("\n\nSearch: Unable to find tag to compute name.\n\n"); + printf("\n\nSearch: Unable to find tag to compute name.\n\n"); #endif continue; } diff --git a/suite/browser/src/nsLocalSearchService.cpp b/suite/browser/src/nsLocalSearchService.cpp index b499dae598e..536db3e8bb2 100755 --- a/suite/browser/src/nsLocalSearchService.cpp +++ b/suite/browser/src/nsLocalSearchService.cpp @@ -43,11 +43,6 @@ #include "nsIRDFObserver.h" #include "nsRDFCID.h" #include "rdf.h" -#include "nslog.h" - -NS_IMPL_LOG(nsLocalSearchServiceLog) -#define PRINTF NS_LOG_PRINTF(nsLocalSearchServiceLog) -#define FLUSH NS_LOG_FLUSH(nsLocalSearchServiceLog) static NS_DEFINE_CID(kRDFServiceCID, NS_RDFSERVICE_CID); static NS_DEFINE_CID(kTextToSubURICID, NS_TEXTTOSUBURI_CID); @@ -283,7 +278,9 @@ LocalSearchDataSource::parseResourceIntoFindTokens(nsIRDFResource *u, findTokenP if (NS_FAILED(rv = u->GetValueConst(&uri))) return(rv); - PRINTF("Find: %s\n", (const char*) uri); +#ifdef DEBUG + printf("Find: %s\n", (const char*) uri); +#endif if (!(id = PL_strdup(uri + sizeof(kFindProtocol) - 1))) return(NS_ERROR_OUT_OF_MEMORY);