whitespace cleanup, comment fix and redundant #define removal.

thanks to gautheri@noos.fr (Serge Gautherie) for the patch.
This commit is contained in:
dwitte%stanford.edu 2003-11-18 15:10:40 +00:00
Родитель 53ed8e42cc
Коммит 58528e3824
2 изменённых файлов: 78 добавлений и 80 удалений

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

@ -74,7 +74,9 @@
static NS_DEFINE_IID(kDocLoaderServiceCID, NS_DOCUMENTLOADER_SERVICE_CID);
////////////////////////////////////////////////////////////////////////////////
// nsWalletlibService
nsWalletlibService::nsWalletlibService()
{
@ -121,15 +123,15 @@ nsWalletlibService::WALLET_RequestToCapture(nsIDOMWindowInternal* aWin,
PRUint32* status)
{
nsCOMPtr<nsIScriptGlobalObject> scriptGlobalObject;
nsCOMPtr<nsIScriptGlobalObject> scriptGlobalObject;
scriptGlobalObject = do_QueryInterface(aWin);
nsCOMPtr<nsIDocShell> docShell;
scriptGlobalObject->GetDocShell(getter_AddRefs(docShell));
nsCOMPtr<nsIDocShell> docShell;
scriptGlobalObject->GetDocShell(getter_AddRefs(docShell));
nsCOMPtr<nsIPresShell> presShell;
if(docShell)
if(docShell)
docShell->GetPresShell(getter_AddRefs(presShell));
::WLLT_RequestToCapture(presShell, aWin, status);
return NS_OK;
}
@ -151,9 +153,9 @@ nsWalletlibService::WALLET_Prefill(PRBool quick,
{
nsCOMPtr<nsIScriptGlobalObject> scriptGlobalObject;
scriptGlobalObject = do_QueryInterface(aWin);
nsCOMPtr<nsIDocShell> docShell;
scriptGlobalObject->GetDocShell(getter_AddRefs(docShell));
nsCOMPtr<nsIDocShell> docShell;
scriptGlobalObject->GetDocShell(getter_AddRefs(docShell));
nsCOMPtr<nsIPresShell> presShell;
if(docShell)
docShell->GetPresShell(getter_AddRefs(presShell));
@ -192,7 +194,6 @@ NS_IMETHODIMP nsWalletlibService::SI_StorePassword(const char *key, const PRUnic
return NS_OK;
}
NS_IMETHODIMP nsWalletlibService::WALLET_GetNopreviewListForViewer(nsAutoString& aNopreviewList){
::WLLT_GetNopreviewListForViewer(aNopreviewList);
return NS_OK;
@ -213,7 +214,7 @@ NS_IMETHODIMP nsWalletlibService::SI_SignonViewerReturn(nsAutoString results){
return NS_OK;
}
NS_IMETHODIMP nsWalletlibService::Observe(nsISupports *aSubject, const char *aTopic, const PRUnichar *someData)
NS_IMETHODIMP nsWalletlibService::Observe(nsISupports *aSubject, const char *aTopic, const PRUnichar *someData)
{
if (!nsCRT::strcmp(aTopic, "profile-before-change")) {
PRBool status;
@ -246,7 +247,7 @@ NS_IMETHODIMP nsWalletlibService::Observe(nsISupports *aSubject, const char *aTo
return NS_OK;
}
#define CRLF "\015\012"
#define CRLF "\015\012"
NS_IMETHODIMP nsWalletlibService::Notify(nsIContent* formNode, nsIDOMWindowInternal* window, nsIURI* actionURL, PRBool* cancelSubmit)
{
if (!formNode) {
@ -286,10 +287,10 @@ nsWalletlibService::UnregisterProc(nsIComponentManager *aCompMgr,
nsresult rv;
nsCOMPtr<nsICategoryManager> catman = do_GetService(NS_CATEGORYMANAGER_CONTRACTID, &rv);
if (NS_FAILED(rv)) return rv;
catman->DeleteCategoryEntry(NS_FIRST_FORMSUBMIT_CATEGORY,
NS_WALLETSERVICE_CONTRACTID, PR_TRUE);
catman->DeleteCategoryEntry(NS_PASSWORDMANAGER_CATEGORY,
NS_WALLETSERVICE_CONTRACTID, PR_TRUE);
@ -314,11 +315,11 @@ ExpireMasterPasswordPrefChanged(const char * newpref, void * data) {
return 0;
}
nsresult nsWalletlibService::Init()
nsresult nsWalletlibService::Init()
{
nsresult rv;
nsCOMPtr<nsIObserverService> svc =
nsCOMPtr<nsIObserverService> svc =
do_GetService("@mozilla.org/observer-service;1", &rv);
if (NS_SUCCEEDED(rv) && svc) {
// Register as an observer of form submission
@ -331,9 +332,9 @@ nsresult nsWalletlibService::Init()
}
else
NS_ASSERTION(PR_FALSE, "Could not get nsIObserverService");
// Get the global document loader service...
nsCOMPtr<nsIDocumentLoader> docLoaderService =
// Get the global document loader service...
nsCOMPtr<nsIDocumentLoader> docLoaderService =
do_GetService(kDocLoaderServiceCID, &rv);
if (NS_SUCCEEDED(rv) && docLoaderService) {
nsCOMPtr<nsIWebProgress> progress(do_QueryInterface(docLoaderService, &rv));
@ -343,7 +344,7 @@ nsresult nsWalletlibService::Init()
}
else
NS_ASSERTION(PR_FALSE, "Could not get nsIDocumentLoader");
/* initialize the expire-master-password feature */
nsCOMPtr<nsIPref> prefs(do_GetService(NS_PREF_CONTRACTID, &rv));
if (NS_SUCCEEDED(rv)) {
@ -356,8 +357,8 @@ nsresult nsWalletlibService::Init()
// nsIWebProgressListener implementation
NS_IMETHODIMP
nsWalletlibService::OnStateChange(nsIWebProgress* aWebProgress,
nsIRequest *aRequest,
nsWalletlibService::OnStateChange(nsIWebProgress* aWebProgress,
nsIRequest *aRequest,
PRUint32 progressStateFlags,
nsresult aStatus)
{
@ -384,13 +385,13 @@ nsWalletlibService::OnStateChange(nsIWebProgress* aWebProgress,
// pre-fill.
nsCOMPtr<nsIDOMHTMLDocument> htmldoc(do_QueryInterface(domDoc, &rv));
if (NS_FAILED(rv)) return NS_OK;
nsCOMPtr<nsIDocument> doc(do_QueryInterface(htmldoc, &rv));
if (NS_FAILED(rv)) {
NS_ASSERTION(0, "no document available");
return NS_OK;
}
nsIURI *uri = doc->GetDocumentURL();
if (!uri) {
NS_ASSERTION(0, "no URI available");
@ -413,7 +414,7 @@ nsWalletlibService::OnStateChange(nsIWebProgress* aWebProgress,
nsCOMPtr<nsIDOMHTMLCollection> elements;
rv = formElement->GetElements(getter_AddRefs(elements));
if ((NS_SUCCEEDED(rv)) && (nsnull != elements)) {
/* got to the form elements at long last */
/* got to the form elements at long last */
PRUint32 numElements;
elements->GetLength(&numElements);
/* get number of passwords on form */
@ -522,7 +523,6 @@ nsWalletlibService::OnLocationChange(nsIWebProgress* aWebProgress,
return NS_OK;
}
NS_IMETHODIMP
nsWalletlibService::OnStatusChange(nsIWebProgress* aWebProgress,
nsIRequest* aRequest,
@ -533,17 +533,15 @@ nsWalletlibService::OnStatusChange(nsIWebProgress* aWebProgress,
return NS_OK;
}
NS_IMETHODIMP
nsWalletlibService::OnSecurityChange(nsIWebProgress *aWebProgress,
nsIRequest *aRequest,
nsWalletlibService::OnSecurityChange(nsIWebProgress *aWebProgress,
nsIRequest *aRequest,
PRUint32 state)
{
NS_NOTREACHED("notification excluded in AddProgressListener(...)");
return NS_OK;
}
NS_IMETHODIMP
nsWalletlibService::HaveData(nsIPrompt* dialog, const char *key, const PRUnichar *userName, PRBool *_retval)
{
@ -582,9 +580,8 @@ nsSingleSignOnPrompt::Init()
return NS_OK;
}
NS_IMETHODIMP
nsSingleSignOnPrompt::Prompt(const PRUnichar *dialogTitle, const PRUnichar *text,
nsSingleSignOnPrompt::Prompt(const PRUnichar *dialogTitle, const PRUnichar *text,
const PRUnichar *passwordRealm, PRUint32 savePassword,
const PRUnichar *defaultText, PRUnichar **result, PRBool *_retval)
{
@ -596,8 +593,8 @@ nsSingleSignOnPrompt::Prompt(const PRUnichar *dialogTitle, const PRUnichar *text
}
NS_IMETHODIMP
nsSingleSignOnPrompt::PromptUsernameAndPassword(const PRUnichar *dialogTitle, const PRUnichar *text,
const PRUnichar *passwordRealm, PRUint32 savePassword,
nsSingleSignOnPrompt::PromptUsernameAndPassword(const PRUnichar *dialogTitle, const PRUnichar *text,
const PRUnichar *passwordRealm, PRUint32 savePassword,
PRUnichar **user, PRUnichar **pwd, PRBool *_retval)
{
nsresult rv;
@ -608,8 +605,8 @@ nsSingleSignOnPrompt::PromptUsernameAndPassword(const PRUnichar *dialogTitle, co
}
NS_IMETHODIMP
nsSingleSignOnPrompt::PromptPassword(const PRUnichar *dialogTitle, const PRUnichar *text,
const PRUnichar *passwordRealm, PRUint32 savePassword,
nsSingleSignOnPrompt::PromptPassword(const PRUnichar *dialogTitle, const PRUnichar *text,
const PRUnichar *passwordRealm, PRUint32 savePassword,
PRUnichar **pwd, PRBool *_retval)
{
nsresult rv;
@ -618,7 +615,7 @@ nsSingleSignOnPrompt::PromptPassword(const PRUnichar *dialogTitle, const PRUnich
NS_ConvertUCS2toUTF8(passwordRealm).get(), mPrompt, _retval, savePassword);
return rv;
}
// nsISingleSignOnPrompt methods:
NS_IMETHODIMP

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

@ -70,7 +70,7 @@
#include "nsIStringBundle.h"
#include "nsIFileSpec.h"
#include "prmem.h"
#include "prprf.h"
#include "prprf.h"
#include "nsIContent.h"
#include "nsIObserverService.h"
@ -223,11 +223,11 @@ public:
};
/*
* The data structure below consists of mapping tables that map one item into another.
* The actual interpretation of the items depend on which table we are in. For
* example, if in the field-to-schema table, item1 is a field name and item2 is a
* schema name. Whereas in the schema-to-value table, item1 is a schema name and
* item2 is a value. Therefore this generic data structure refers to them simply as
* The data structure below consists of mapping tables that map one item into another.
* The actual interpretation of the items depend on which table we are in. For
* example, if in the field-to-schema table, item1 is a field name and item2 is a
* schema name. Whereas in the schema-to-value table, item1 is a schema name and
* item2 is a value. Therefore this generic data structure refers to them simply as
* item1 and item2.
*/
MOZ_DECL_CTOR_COUNTER(wallet_MapElement)
@ -287,16 +287,16 @@ public:
};
wallet_HelpMac * helpMac;
PRIVATE nsVoidArray * wallet_FieldToSchema_list=0;
PRIVATE nsVoidArray * wallet_VcardToSchema_list=0;
PRIVATE nsVoidArray * wallet_SchemaToValue_list=0;
PRIVATE nsVoidArray * wallet_SchemaConcat_list=0;
PRIVATE nsVoidArray * wallet_SchemaStrings_list=0;
PRIVATE nsVoidArray * wallet_PositionalSchema_list=0;
PRIVATE nsVoidArray * wallet_StateSchema_list=0;
PRIVATE nsVoidArray * wallet_URL_list=0;
PRIVATE nsVoidArray * wallet_FieldToSchema_list = 0;
PRIVATE nsVoidArray * wallet_VcardToSchema_list = 0;
PRIVATE nsVoidArray * wallet_SchemaToValue_list = 0;
PRIVATE nsVoidArray * wallet_SchemaConcat_list = 0;
PRIVATE nsVoidArray * wallet_SchemaStrings_list = 0;
PRIVATE nsVoidArray * wallet_PositionalSchema_list = 0;
PRIVATE nsVoidArray * wallet_StateSchema_list = 0;
PRIVATE nsVoidArray * wallet_URL_list = 0;
#ifdef AutoCapture
PRIVATE nsVoidArray * wallet_DistinguishedSchema_list=0;
PRIVATE nsVoidArray * wallet_DistinguishedSchema_list = 0;
#endif
#define NO_CAPTURE(x) x[0]
@ -387,7 +387,7 @@ PRBool stopwatchRunning = PR_FALSE;
static void
wallet_ClearTiming() {
timing_index = 0;
timing_index = 0;
LL_I2L(timings[timing_index++], PR_IntervalNow());
}
@ -458,7 +458,7 @@ wallet_DumpStopwatch() {
LL_I2L(r1, 100);
LL_DIV(r2, stopwatch, r1);
LL_L2I(r3, r2);
fprintf(stdout, "stopwatch = %ld\n", (long)r3);
fprintf(stdout, "stopwatch = %ld\n", (long)r3);
}
#endif /* DEBUG_morse */
@ -526,9 +526,9 @@ Wallet_Confirm(PRUnichar * szMessage, nsIDOMWindowInternal* window)
{
PRBool retval = PR_TRUE; /* default value */
nsresult res;
nsCOMPtr<nsIPrompt> dialog;
window->GetPrompter(getter_AddRefs(dialog));
nsresult res;
nsCOMPtr<nsIPrompt> dialog;
window->GetPrompter(getter_AddRefs(dialog));
if (!dialog) {
return retval;
}
@ -541,9 +541,9 @@ Wallet_Confirm(PRUnichar * szMessage, nsIDOMWindowInternal* window)
PUBLIC PRBool
Wallet_ConfirmYN(PRUnichar * szMessage, nsIDOMWindowInternal* window) {
nsresult res;
nsCOMPtr<nsIPrompt> dialog;
window->GetPrompter(getter_AddRefs(dialog));
nsresult res;
nsCOMPtr<nsIPrompt> dialog;
window->GetPrompter(getter_AddRefs(dialog));
if (!dialog) {
return PR_FALSE;
}
@ -563,9 +563,9 @@ Wallet_ConfirmYN(PRUnichar * szMessage, nsIDOMWindowInternal* window) {
PUBLIC PRInt32
Wallet_3ButtonConfirm(PRUnichar * szMessage, nsIDOMWindowInternal* window)
{
nsresult res;
nsCOMPtr<nsIPrompt> dialog;
window->GetPrompter(getter_AddRefs(dialog));
nsresult res;
nsCOMPtr<nsIPrompt> dialog;
window->GetPrompter(getter_AddRefs(dialog));
if (!dialog) {
return 0; /* default value is NO */
}
@ -590,8 +590,8 @@ PRIVATE void
wallet_Alert(PRUnichar * szMessage, nsIDOMWindowInternal* window)
{
nsresult res;
nsCOMPtr<nsIPrompt> dialog;
window->GetPrompter(getter_AddRefs(dialog));
nsCOMPtr<nsIPrompt> dialog;
window->GetPrompter(getter_AddRefs(dialog));
if (!dialog) {
return; // XXX should return the error
}
@ -606,7 +606,7 @@ wallet_Alert(PRUnichar * szMessage, nsIDOMWindowInternal* window)
PRIVATE void
wallet_Alert(PRUnichar * szMessage, nsIPrompt* dialog)
{
nsresult res;
nsresult res;
const nsAutoString message( szMessage );
PRUnichar * title = Wallet_Localize("CaveatTitle");
res = dialog->Alert(title, message.get());
@ -619,8 +619,8 @@ Wallet_CheckConfirmYN
(PRUnichar * szMessage, PRUnichar * szCheckMessage, PRBool* checkValue,
nsIDOMWindowInternal* window) {
nsresult res;
nsCOMPtr<nsIPrompt> dialog;
window->GetPrompter(getter_AddRefs(dialog));
nsCOMPtr<nsIPrompt> dialog;
window->GetPrompter(getter_AddRefs(dialog));
if (!dialog) {
return PR_FALSE;
}
@ -878,7 +878,7 @@ wallet_Clear(nsVoidArray ** list) {
* element at a time was very inefficient on the mac
*/
PRIVATE nsVoidArray * wallet_MapElementAllocations_list=0;
PRIVATE nsVoidArray * wallet_MapElementAllocations_list = 0;
const PRInt32 kAllocBlockElems = 500;
static PRInt32 wallet_NextAllocSlot = kAllocBlockElems;
@ -1986,7 +1986,7 @@ wallet_StepForwardOrBack
if (siblingNameUTF8.EqualsIgnoreCase("#text")) {
nsAutoString siblingValue;
result = elementNode->GetNodeValue(siblingValue);
text.Append(siblingValue);
text.Append(siblingValue);
}
/* if we've reached a SCRIPT node, don't fetch its siblings */
@ -2019,7 +2019,7 @@ wallet_StepForwardOrBack
//#include "nsICaseConversion.h"
//static NS_DEFINE_IID(kICaseConversionIID, NS_ICASECONVERSION_IID);
//static nsICaseConversion* gCaseConv = nsnull;
//static nsICaseConversion* gCaseConv = nsnull;
static void
wallet_ResolvePositionalSchema(nsIDOMNode* elementNode, nsACString& schema) {
@ -2110,7 +2110,7 @@ wallet_ResolvePositionalSchema(nsIDOMNode* elementNode, nsACString& schema) {
// nsresult res = nsServiceManager::GetService(kUnicharUtilCID, kICaseConversionIID,
// (nsISupports**)&gCaseConv);
//
// nsIUGenCategory* intl = nsnull;
// nsIUGenCategory* intl = nsnull;
// nsresult rv = nsServiceManager::GetService(kUnicharUtilCID, kIUGenCategoryIID,
// (nsISupports**)&intl);
// Whaaaaaa, intl is never released here!
@ -2341,7 +2341,7 @@ wallet_GetSchemaFromDisplayableText
/* process state schema if any */
if (!skipStateChecking && !schema.IsEmpty() && schema.First() == '$') {
wallet_ResolveStateSchema(elementNode, schema);
wallet_ResolveStateSchema(elementNode, schema);
}
lastSchema.Assign(schema);
return;
@ -2373,7 +2373,7 @@ wallet_GetSchemaFromDisplayableText
*/
if (!skipStateChecking && !schema.IsEmpty() && schema.First() == '$') {
wallet_ResolveStateSchema(elementNode, schema);
wallet_ResolveStateSchema(elementNode, schema);
}
lastSchema.Assign(schema);
@ -3639,7 +3639,7 @@ PRIVATE PRBool
wallet_CaptureInputElement(nsIDOMNode* elementNode, nsIDocument* doc) {
nsresult result;
PRBool captured = PR_FALSE;
nsCOMPtr<nsIDOMHTMLInputElement> inputElement = do_QueryInterface(elementNode);
nsCOMPtr<nsIDOMHTMLInputElement> inputElement = do_QueryInterface(elementNode);
if (inputElement) {
/* it's an input element */
nsAutoString type;
@ -3685,7 +3685,7 @@ PRIVATE PRBool
wallet_CaptureSelectElement(nsIDOMNode* elementNode, nsIDocument* doc) {
nsresult result;
PRBool captured = PR_FALSE;
nsCOMPtr<nsIDOMHTMLSelectElement> selectElement = do_QueryInterface(elementNode);
nsCOMPtr<nsIDOMHTMLSelectElement> selectElement = do_QueryInterface(elementNode);
if (selectElement) {
/* it's a dropdown list */
nsAutoString field;
@ -3980,10 +3980,11 @@ WLLT_OnSubmit(nsIContent* currentForm, nsIDOMWindowInternal* window) {
isPassword = PR_FALSE;
}
}
#define WALLET_DONT_CACHE_ALL_PASSWORDS
#ifdef WALLET_DONT_CACHE_ALL_PASSWORDS
// Do not store this form element if the 'autocomplete = off' attibute is present,
// unless 'wallet.crypto.autocompleteoverride' is enabled.
// Do not store this 'password' form element if the 'autocomplete = off'
// attribute is present, unless the 'wallet.crypto.autocompleteoverride'
// preference is enabled. (The "autocomplete" property is a Microsoft
// extension to HTML.)
if (isPassword && !SI_GetBoolPref(pref_AutoCompleteOverride, PR_FALSE)) {
nsAutoString val;
(void) inputElement->GetAttribute(NS_LITERAL_STRING("autocomplete"), val);
@ -3996,7 +3997,7 @@ WLLT_OnSubmit(nsIContent* currentForm, nsIDOMWindowInternal* window) {
}
}
}
#endif
#ifdef AutoCapture
if (isPassword) {
passwordcount++;