From 1e45eadc55b2569ba5c7faec4f46a195e705af85 Mon Sep 17 00:00:00 2001 From: "bzbarsky%mit.edu" Date: Tue, 27 May 2003 03:49:22 +0000 Subject: [PATCH] Make some static data const in content. Bug 204532, patch by ataylor@its.to (Andrew Taylor), r=bzbarsky, sr=alecf --- content/base/src/nsContentUtils.cpp | 2 +- content/base/src/nsDOMBuilder.cpp | 2 +- content/base/src/nsHTMLContentSerializer.cpp | 6 ++--- content/base/src/nsHTMLValue.cpp | 4 ++-- content/base/src/nsHTMLValue.h | 4 ++-- content/base/src/nsPrintEngine.cpp | 2 +- content/base/src/nsSyncLoadService.cpp | 2 +- content/base/src/nsXMLContentSerializer.cpp | 2 +- .../html/content/src/nsGenericHTMLElement.cpp | 22 +++++++++---------- content/html/content/src/nsHTMLBRElement.cpp | 2 +- .../html/content/src/nsHTMLButtonElement.cpp | 4 ++-- .../html/content/src/nsHTMLFormElement.cpp | 4 ++-- content/html/content/src/nsHTMLHRElement.cpp | 2 +- .../html/content/src/nsHTMLInputElement.cpp | 4 ++-- content/html/content/src/nsHTMLLIElement.cpp | 4 ++-- .../html/content/src/nsHTMLLegendElement.cpp | 2 +- .../content/src/nsHTMLSharedContainerElem.cpp | 2 +- .../content/src/nsHTMLTableCaptionElement.cpp | 2 +- .../content/src/nsHTMLTableCellElement.cpp | 2 +- .../html/content/src/nsHTMLTableElement.cpp | 6 ++--- content/html/style/src/nsCSSScanner.cpp | 6 +---- content/shared/public/nsHTMLValue.h | 4 ++-- content/shared/src/nsHTMLValue.cpp | 4 ++-- content/xml/document/src/nsXMLContentSink.cpp | 4 ++-- layout/printing/nsPrintEngine.cpp | 2 +- layout/style/nsCSSScanner.cpp | 6 +---- 26 files changed, 49 insertions(+), 57 deletions(-) diff --git a/content/base/src/nsContentUtils.cpp b/content/base/src/nsContentUtils.cpp index ff7d4da849d..5243fa8c5d6 100644 --- a/content/base/src/nsContentUtils.cpp +++ b/content/base/src/nsContentUtils.cpp @@ -63,7 +63,7 @@ #include "nsIServiceManager.h" #include "nsIAttribute.h" -static const char *kJSStackContractID = "@mozilla.org/js/xpc/ContextStack;1"; +static const char kJSStackContractID[] = "@mozilla.org/js/xpc/ContextStack;1"; static NS_DEFINE_IID(kParserServiceCID, NS_PARSERSERVICE_CID); nsIDOMScriptObjectFactory *nsContentUtils::sDOMScriptObjectFactory = nsnull; diff --git a/content/base/src/nsDOMBuilder.cpp b/content/base/src/nsDOMBuilder.cpp index c668fb34355..9337ca0e660 100644 --- a/content/base/src/nsDOMBuilder.cpp +++ b/content/base/src/nsDOMBuilder.cpp @@ -41,7 +41,7 @@ #include "nsContentUtils.h" // for NS_INTERFACE_MAP_ENTRY_CONTENT_CLASSINFO #include "nsIDOMDocument.h" -static const char* kLoadAsData = "loadAsData"; +static const char kLoadAsData[] = "loadAsData"; nsresult NS_NewDOMBuilder(nsIDOMDOMBuilder** aResult, diff --git a/content/base/src/nsHTMLContentSerializer.cpp b/content/base/src/nsHTMLContentSerializer.cpp index 90618a49ded..5fa7d71ff27 100644 --- a/content/base/src/nsHTMLContentSerializer.cpp +++ b/content/base/src/nsHTMLContentSerializer.cpp @@ -887,10 +887,10 @@ nsHTMLContentSerializer::AppendToString(const PRUnichar aChar, aOutputStr.Append(aChar); } -static PRUint16 kValNBSP = 160; -static const char* kEntityNBSP = "nbsp"; +static const PRUint16 kValNBSP = 160; +static const char kEntityNBSP[] = "nbsp"; -static PRUint16 kGTVal = 62; +static const PRUint16 kGTVal = 62; static const char* kEntities[] = { "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", diff --git a/content/base/src/nsHTMLValue.cpp b/content/base/src/nsHTMLValue.cpp index 64cf34d335a..cfb52e9aeb5 100644 --- a/content/base/src/nsHTMLValue.cpp +++ b/content/base/src/nsHTMLValue.cpp @@ -390,7 +390,7 @@ nsHTMLValue::InitializeFrom(const nsHTMLValue& aCopy) PRBool nsHTMLValue::ParseEnumValue(const nsAString& aValue, - EnumTable* aTable, + const EnumTable* aTable, PRBool aCaseSensitive) { nsAutoString val(aValue); @@ -406,7 +406,7 @@ nsHTMLValue::ParseEnumValue(const nsAString& aValue, } PRBool -nsHTMLValue::EnumValueToString(EnumTable* aTable, +nsHTMLValue::EnumValueToString(const EnumTable* aTable, nsAString& aResult) const { if (GetUnit() == eHTMLUnit_Enumerated) { diff --git a/content/base/src/nsHTMLValue.h b/content/base/src/nsHTMLValue.h index 3e1624a03e6..24a64ebe905 100644 --- a/content/base/src/nsHTMLValue.h +++ b/content/base/src/nsHTMLValue.h @@ -261,7 +261,7 @@ public: * @return whether the enum value was found or not */ PRBool ParseEnumValue(const nsAString& aValue, - EnumTable* aTable, + const EnumTable* aTable, PRBool aCaseSensitive = PR_FALSE); /** @@ -272,7 +272,7 @@ public: * @param aResult the string the value maps to [OUT] * @return whether the enum value was found or not */ - PRBool EnumValueToString(EnumTable* aTable, + PRBool EnumValueToString(const EnumTable* aTable, nsAString& aResult) const; /** diff --git a/content/base/src/nsPrintEngine.cpp b/content/base/src/nsPrintEngine.cpp index ad17bffa842..ded0419f961 100644 --- a/content/base/src/nsPrintEngine.cpp +++ b/content/base/src/nsPrintEngine.cpp @@ -95,7 +95,7 @@ static const char sPrintOptionsContractID[] = "@mozilla.org/gfx/printset // Printing Prompts #include "nsIPrintingPromptService.h" -static const char* kPrintingPromptService = "@mozilla.org/embedcomp/printingprompt-service;1"; +static const char kPrintingPromptService[] = "@mozilla.org/embedcomp/printingprompt-service;1"; #define NS_ERROR_GFX_PRINTER_BUNDLE_URL "chrome://global/locale/printing.properties" diff --git a/content/base/src/nsSyncLoadService.cpp b/content/base/src/nsSyncLoadService.cpp index 525729238ca..c96939eefd6 100644 --- a/content/base/src/nsSyncLoadService.cpp +++ b/content/base/src/nsSyncLoadService.cpp @@ -66,7 +66,7 @@ #include "nsIContent.h" #include "nsAutoPtr.h" -static const char* kLoadAsData = "loadAsData"; +static const char kLoadAsData[] = "loadAsData"; static NS_DEFINE_CID(kIDOMDOMImplementationCID, NS_DOM_IMPLEMENTATION_CID); static NS_DEFINE_CID(kEventQueueServiceCID, NS_EVENTQUEUESERVICE_CID); diff --git a/content/base/src/nsXMLContentSerializer.cpp b/content/base/src/nsXMLContentSerializer.cpp index c886e286ea8..e177dd468c3 100644 --- a/content/base/src/nsXMLContentSerializer.cpp +++ b/content/base/src/nsXMLContentSerializer.cpp @@ -648,7 +648,7 @@ nsXMLContentSerializer::AppendToString(const PRUnichar aChar, aOutputStr.Append(aChar); } -static PRUint16 kGTVal = 62; +static const PRUint16 kGTVal = 62; static const char* kEntities[] = { "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", diff --git a/content/html/content/src/nsGenericHTMLElement.cpp b/content/html/content/src/nsGenericHTMLElement.cpp index 64481796804..84e9c07d3b7 100644 --- a/content/html/content/src/nsGenericHTMLElement.cpp +++ b/content/html/content/src/nsGenericHTMLElement.cpp @@ -457,7 +457,7 @@ nsGenericHTMLElement::SetLang(const nsAString& aLang) return NS_OK; } -static nsHTMLValue::EnumTable kDirTable[] = { +static const nsHTMLValue::EnumTable kDirTable[] = { { "ltr", NS_STYLE_DIRECTION_LTR }, { "rtl", NS_STYLE_DIRECTION_RTL }, { 0 } @@ -2762,7 +2762,7 @@ nsGenericHTMLElement::GetPresContext(nsIHTMLContent* aContent, } // XXX check all mappings against ebina's usage -static nsHTMLValue::EnumTable kAlignTable[] = { +static const nsHTMLValue::EnumTable kAlignTable[] = { { "left", NS_STYLE_TEXT_ALIGN_LEFT }, { "right", NS_STYLE_TEXT_ALIGN_RIGHT }, @@ -2780,7 +2780,7 @@ static nsHTMLValue::EnumTable kAlignTable[] = { // Elements that should return vertical align values "middle", "bottom", and "top" // instead of "center", "baseline", and "texttop" from GetAttribute() should use this -static nsHTMLValue::EnumTable kVAlignTable[] = { +static const nsHTMLValue::EnumTable kVAlignTable[] = { { "left", NS_STYLE_TEXT_ALIGN_LEFT }, { "right", NS_STYLE_TEXT_ALIGN_RIGHT }, { "top", NS_STYLE_VERTICAL_ALIGN_TOP },//verified @@ -2795,7 +2795,7 @@ static nsHTMLValue::EnumTable kVAlignTable[] = { { 0 } }; -static nsHTMLValue::EnumTable kDivAlignTable[] = { +static const nsHTMLValue::EnumTable kDivAlignTable[] = { { "left", NS_STYLE_TEXT_ALIGN_LEFT }, { "right", NS_STYLE_TEXT_ALIGN_MOZ_RIGHT }, { "center", NS_STYLE_TEXT_ALIGN_MOZ_CENTER }, @@ -2804,7 +2804,7 @@ static nsHTMLValue::EnumTable kDivAlignTable[] = { { 0 } }; -static nsHTMLValue::EnumTable kFrameborderTable[] = { +static const nsHTMLValue::EnumTable kFrameborderTable[] = { { "yes", NS_STYLE_FRAME_YES }, { "no", NS_STYLE_FRAME_NO }, { "1", NS_STYLE_FRAME_1 }, @@ -2812,7 +2812,7 @@ static nsHTMLValue::EnumTable kFrameborderTable[] = { { 0 } }; -static nsHTMLValue::EnumTable kScrollingTable[] = { +static const nsHTMLValue::EnumTable kScrollingTable[] = { { "yes", NS_STYLE_FRAME_YES }, { "no", NS_STYLE_FRAME_NO }, { "on", NS_STYLE_FRAME_ON }, @@ -2823,7 +2823,7 @@ static nsHTMLValue::EnumTable kScrollingTable[] = { { 0 } }; -static nsHTMLValue::EnumTable kTableVAlignTable[] = { +static const nsHTMLValue::EnumTable kTableVAlignTable[] = { { "top", NS_STYLE_VERTICAL_ALIGN_TOP }, { "middle", NS_STYLE_VERTICAL_ALIGN_MIDDLE }, { "bottom", NS_STYLE_VERTICAL_ALIGN_BOTTOM }, @@ -2856,7 +2856,7 @@ nsGenericHTMLElement::ParseAlignValue(const nsAString& aString, //---------------------------------------- // Vanilla table as defined by the html4 spec... -static nsHTMLValue::EnumTable kTableHAlignTable[] = { +static const nsHTMLValue::EnumTable kTableHAlignTable[] = { { "left", NS_STYLE_TEXT_ALIGN_LEFT }, { "right", NS_STYLE_TEXT_ALIGN_RIGHT }, { "center", NS_STYLE_TEXT_ALIGN_CENTER }, @@ -2866,7 +2866,7 @@ static nsHTMLValue::EnumTable kTableHAlignTable[] = { }; // This table is used for TABLE when in compatability mode -static nsHTMLValue::EnumTable kCompatTableHAlignTable[] = { +static const nsHTMLValue::EnumTable kCompatTableHAlignTable[] = { { "left", NS_STYLE_TEXT_ALIGN_LEFT }, { "right", NS_STYLE_TEXT_ALIGN_RIGHT }, { "center", NS_STYLE_TEXT_ALIGN_CENTER }, @@ -2901,7 +2901,7 @@ nsGenericHTMLElement::TableHAlignValueToString(const nsHTMLValue& aValue, //---------------------------------------- // These tables are used for TD,TH,TR, etc (but not TABLE) -static nsHTMLValue::EnumTable kTableCellHAlignTable[] = { +static const nsHTMLValue::EnumTable kTableCellHAlignTable[] = { { "left", NS_STYLE_TEXT_ALIGN_LEFT }, { "right", NS_STYLE_TEXT_ALIGN_MOZ_RIGHT }, { "center", NS_STYLE_TEXT_ALIGN_MOZ_CENTER }, @@ -2910,7 +2910,7 @@ static nsHTMLValue::EnumTable kTableCellHAlignTable[] = { { 0 } }; -static nsHTMLValue::EnumTable kCompatTableCellHAlignTable[] = { +static const nsHTMLValue::EnumTable kCompatTableCellHAlignTable[] = { { "left", NS_STYLE_TEXT_ALIGN_LEFT }, { "right", NS_STYLE_TEXT_ALIGN_MOZ_RIGHT }, { "center", NS_STYLE_TEXT_ALIGN_MOZ_CENTER }, diff --git a/content/html/content/src/nsHTMLBRElement.cpp b/content/html/content/src/nsHTMLBRElement.cpp index 6fff059acbe..5c83eb6122e 100644 --- a/content/html/content/src/nsHTMLBRElement.cpp +++ b/content/html/content/src/nsHTMLBRElement.cpp @@ -156,7 +156,7 @@ nsHTMLBRElement::CloneNode(PRBool aDeep, nsIDOMNode** aReturn) NS_IMPL_STRING_ATTR(nsHTMLBRElement, Clear, clear) -static nsHTMLValue::EnumTable kClearTable[] = { +static const nsHTMLValue::EnumTable kClearTable[] = { { "left", NS_STYLE_CLEAR_LEFT }, { "right", NS_STYLE_CLEAR_RIGHT }, { "all", NS_STYLE_CLEAR_LEFT_AND_RIGHT }, diff --git a/content/html/content/src/nsHTMLButtonElement.cpp b/content/html/content/src/nsHTMLButtonElement.cpp index 03bb8869758..cf2920c21d1 100644 --- a/content/html/content/src/nsHTMLButtonElement.cpp +++ b/content/html/content/src/nsHTMLButtonElement.cpp @@ -373,7 +373,7 @@ nsHTMLButtonElement::RemoveFocus(nsIPresContext* aPresContext) return rv; } -static nsHTMLValue::EnumTable kButtonTypeTable[] = { +static const nsHTMLValue::EnumTable kButtonTypeTable[] = { { "button", NS_FORM_BUTTON_BUTTON }, { "reset", NS_FORM_BUTTON_RESET }, { "submit", NS_FORM_BUTTON_SUBMIT }, @@ -391,7 +391,7 @@ nsHTMLButtonElement::StringToAttribute(nsIAtom* aAttribute, } } else if (aAttribute == nsHTMLAtoms::type) { - nsHTMLValue::EnumTable *table = kButtonTypeTable; + const nsHTMLValue::EnumTable *table = kButtonTypeTable; nsAutoString val(aValue); while (nsnull != table->tag) { if (val.EqualsIgnoreCase(table->tag)) { diff --git a/content/html/content/src/nsHTMLFormElement.cpp b/content/html/content/src/nsHTMLFormElement.cpp index b4a5d9af471..e1d2760e8e5 100644 --- a/content/html/content/src/nsHTMLFormElement.cpp +++ b/content/html/content/src/nsHTMLFormElement.cpp @@ -614,13 +614,13 @@ nsHTMLFormElement::Reset() return rv; } -static nsHTMLValue::EnumTable kFormMethodTable[] = { +static const nsHTMLValue::EnumTable kFormMethodTable[] = { { "get", NS_FORM_METHOD_GET }, { "post", NS_FORM_METHOD_POST }, { 0 } }; -static nsHTMLValue::EnumTable kFormEnctypeTable[] = { +static const nsHTMLValue::EnumTable kFormEnctypeTable[] = { { "multipart/form-data", NS_FORM_ENCTYPE_MULTIPART }, { "application/x-www-form-urlencoded", NS_FORM_ENCTYPE_URLENCODED }, { "text/plain", NS_FORM_ENCTYPE_TEXTPLAIN }, diff --git a/content/html/content/src/nsHTMLHRElement.cpp b/content/html/content/src/nsHTMLHRElement.cpp index 929e7b62bff..59e38f07e7b 100644 --- a/content/html/content/src/nsHTMLHRElement.cpp +++ b/content/html/content/src/nsHTMLHRElement.cpp @@ -160,7 +160,7 @@ NS_IMPL_BOOL_ATTR(nsHTMLHRElement, NoShade, noshade) NS_IMPL_STRING_ATTR(nsHTMLHRElement, Size, size) NS_IMPL_STRING_ATTR(nsHTMLHRElement, Width, width) -static nsHTMLValue::EnumTable kAlignTable[] = { +static const nsHTMLValue::EnumTable kAlignTable[] = { { "left", NS_STYLE_TEXT_ALIGN_LEFT }, { "right", NS_STYLE_TEXT_ALIGN_RIGHT }, { "center", NS_STYLE_TEXT_ALIGN_CENTER }, diff --git a/content/html/content/src/nsHTMLInputElement.cpp b/content/html/content/src/nsHTMLInputElement.cpp index 603354c442e..533fd711795 100644 --- a/content/html/content/src/nsHTMLInputElement.cpp +++ b/content/html/content/src/nsHTMLInputElement.cpp @@ -1801,7 +1801,7 @@ nsHTMLInputElement::SetDocument(nsIDocument* aDocument, PRBool aDeep, // nsIHTMLContent -static nsHTMLValue::EnumTable kInputTypeTable[] = { +static const nsHTMLValue::EnumTable kInputTypeTable[] = { { "browse", NS_FORM_BROWSE }, // XXX not valid html, but it is convenient { "button", NS_FORM_INPUT_BUTTON }, { "checkbox", NS_FORM_INPUT_CHECKBOX }, @@ -1822,7 +1822,7 @@ nsHTMLInputElement::StringToAttribute(nsIAtom* aAttribute, nsHTMLValue& aResult) { if (aAttribute == nsHTMLAtoms::type) { - nsHTMLValue::EnumTable *table = kInputTypeTable; + const nsHTMLValue::EnumTable *table = kInputTypeTable; nsAutoString valueStr(aValue); while (nsnull != table->tag) { if (valueStr.EqualsIgnoreCase(table->tag)) { diff --git a/content/html/content/src/nsHTMLLIElement.cpp b/content/html/content/src/nsHTMLLIElement.cpp index 0dda626f955..6dfc10170ad 100644 --- a/content/html/content/src/nsHTMLLIElement.cpp +++ b/content/html/content/src/nsHTMLLIElement.cpp @@ -159,7 +159,7 @@ NS_IMPL_STRING_ATTR(nsHTMLLIElement, Type, type) NS_IMPL_INT_ATTR(nsHTMLLIElement, Value, value) -static nsHTMLValue::EnumTable kUnorderedListItemTypeTable[] = { +static const nsHTMLValue::EnumTable kUnorderedListItemTypeTable[] = { { "disc", NS_STYLE_LIST_STYLE_DISC }, { "circle", NS_STYLE_LIST_STYLE_CIRCLE }, { "round", NS_STYLE_LIST_STYLE_CIRCLE }, @@ -167,7 +167,7 @@ static nsHTMLValue::EnumTable kUnorderedListItemTypeTable[] = { { 0 } }; -static nsHTMLValue::EnumTable kOrderedListItemTypeTable[] = { +static const nsHTMLValue::EnumTable kOrderedListItemTypeTable[] = { { "A", NS_STYLE_LIST_STYLE_OLD_UPPER_ALPHA }, { "a", NS_STYLE_LIST_STYLE_OLD_LOWER_ALPHA }, { "I", NS_STYLE_LIST_STYLE_OLD_UPPER_ROMAN }, diff --git a/content/html/content/src/nsHTMLLegendElement.cpp b/content/html/content/src/nsHTMLLegendElement.cpp index 0251d48ffc1..62246ef46aa 100644 --- a/content/html/content/src/nsHTMLLegendElement.cpp +++ b/content/html/content/src/nsHTMLLegendElement.cpp @@ -172,7 +172,7 @@ NS_IMPL_STRING_ATTR(nsHTMLLegendElement, AccessKey, accesskey) NS_IMPL_STRING_ATTR(nsHTMLLegendElement, Align, align) // this contains center, because IE4 does -static nsHTMLValue::EnumTable kAlignTable[] = { +static const nsHTMLValue::EnumTable kAlignTable[] = { { "left", NS_STYLE_TEXT_ALIGN_LEFT }, { "right", NS_STYLE_TEXT_ALIGN_RIGHT }, { "center", NS_STYLE_TEXT_ALIGN_CENTER }, diff --git a/content/html/content/src/nsHTMLSharedContainerElem.cpp b/content/html/content/src/nsHTMLSharedContainerElem.cpp index 66b5b87814f..7be1e6f35d8 100644 --- a/content/html/content/src/nsHTMLSharedContainerElem.cpp +++ b/content/html/content/src/nsHTMLSharedContainerElem.cpp @@ -233,7 +233,7 @@ nsHTMLValue::EnumTable kOldListTypeTable[] = { { 0 } }; -static nsHTMLValue::EnumTable kCaptionAlignTable[] = { +static const nsHTMLValue::EnumTable kCaptionAlignTable[] = { { "left", NS_SIDE_LEFT }, { "right", NS_SIDE_RIGHT }, { "top", NS_SIDE_TOP}, diff --git a/content/html/content/src/nsHTMLTableCaptionElement.cpp b/content/html/content/src/nsHTMLTableCaptionElement.cpp index e5a852eea9f..2f46a31c518 100644 --- a/content/html/content/src/nsHTMLTableCaptionElement.cpp +++ b/content/html/content/src/nsHTMLTableCaptionElement.cpp @@ -158,7 +158,7 @@ nsHTMLTableCaptionElement::CloneNode(PRBool aDeep, nsIDOMNode** aReturn) NS_IMPL_STRING_ATTR(nsHTMLTableCaptionElement, Align, align) -static nsHTMLValue::EnumTable kCaptionAlignTable[] = { +static const nsHTMLValue::EnumTable kCaptionAlignTable[] = { { "left", NS_SIDE_LEFT }, { "right", NS_SIDE_RIGHT }, { "top", NS_SIDE_TOP}, diff --git a/content/html/content/src/nsHTMLTableCellElement.cpp b/content/html/content/src/nsHTMLTableCellElement.cpp index a1108019806..8bc63563f7a 100644 --- a/content/html/content/src/nsHTMLTableCellElement.cpp +++ b/content/html/content/src/nsHTMLTableCellElement.cpp @@ -315,7 +315,7 @@ nsHTMLTableCellElement::SetAlign(const nsAString& aValue) } -static nsHTMLValue::EnumTable kCellScopeTable[] = { +static const nsHTMLValue::EnumTable kCellScopeTable[] = { { "row", NS_STYLE_CELL_SCOPE_ROW }, { "col", NS_STYLE_CELL_SCOPE_COL }, { "rowgroup", NS_STYLE_CELL_SCOPE_ROWGROUP }, diff --git a/content/html/content/src/nsHTMLTableElement.cpp b/content/html/content/src/nsHTMLTableElement.cpp index 3ae0a8d45fd..cf0caacbf1e 100644 --- a/content/html/content/src/nsHTMLTableElement.cpp +++ b/content/html/content/src/nsHTMLTableElement.cpp @@ -933,7 +933,7 @@ nsHTMLTableElement::DeleteRow(PRInt32 aValue) return parent->RemoveChild(row, getter_AddRefs(deleted_row)); } -static nsHTMLValue::EnumTable kFrameTable[] = { +static const nsHTMLValue::EnumTable kFrameTable[] = { { "void", NS_STYLE_TABLE_FRAME_NONE }, { "above", NS_STYLE_TABLE_FRAME_ABOVE }, { "below", NS_STYLE_TABLE_FRAME_BELOW }, @@ -946,7 +946,7 @@ static nsHTMLValue::EnumTable kFrameTable[] = { { 0 } }; -static nsHTMLValue::EnumTable kRulesTable[] = { +static const nsHTMLValue::EnumTable kRulesTable[] = { { "none", NS_STYLE_TABLE_RULES_NONE }, { "groups", NS_STYLE_TABLE_RULES_GROUPS }, { "rows", NS_STYLE_TABLE_RULES_ROWS }, @@ -955,7 +955,7 @@ static nsHTMLValue::EnumTable kRulesTable[] = { { 0 } }; -static nsHTMLValue::EnumTable kLayoutTable[] = { +static const nsHTMLValue::EnumTable kLayoutTable[] = { { "auto", NS_STYLE_TABLE_LAYOUT_AUTO }, { "fixed", NS_STYLE_TABLE_LAYOUT_FIXED }, { 0 } diff --git a/content/html/style/src/nsCSSScanner.cpp b/content/html/style/src/nsCSSScanner.cpp index a390c81d5ce..065bf81e9be 100644 --- a/content/html/style/src/nsCSSScanner.cpp +++ b/content/html/style/src/nsCSSScanner.cpp @@ -43,10 +43,6 @@ #include "nsString.h" #include "nsCRT.h" -#ifdef NS_DEBUG -static char* kNullPointer = "null pointer"; -#endif - // for #ifdef CSS_REPORT_PARSE_ERRORS #include "nsCOMPtr.h" #include "nsIServiceManager.h" @@ -205,7 +201,7 @@ nsCSSScanner::~nsCSSScanner() void nsCSSScanner::Init(nsIUnicharInputStream* aInput, nsIURI* aURI) { - NS_PRECONDITION(nsnull != aInput, kNullPointer); + NS_PRECONDITION(nsnull != aInput, "Null input stream pointer"); Close(); mInput = aInput; NS_IF_ADDREF(aInput); diff --git a/content/shared/public/nsHTMLValue.h b/content/shared/public/nsHTMLValue.h index 3e1624a03e6..24a64ebe905 100644 --- a/content/shared/public/nsHTMLValue.h +++ b/content/shared/public/nsHTMLValue.h @@ -261,7 +261,7 @@ public: * @return whether the enum value was found or not */ PRBool ParseEnumValue(const nsAString& aValue, - EnumTable* aTable, + const EnumTable* aTable, PRBool aCaseSensitive = PR_FALSE); /** @@ -272,7 +272,7 @@ public: * @param aResult the string the value maps to [OUT] * @return whether the enum value was found or not */ - PRBool EnumValueToString(EnumTable* aTable, + PRBool EnumValueToString(const EnumTable* aTable, nsAString& aResult) const; /** diff --git a/content/shared/src/nsHTMLValue.cpp b/content/shared/src/nsHTMLValue.cpp index 64cf34d335a..cfb52e9aeb5 100644 --- a/content/shared/src/nsHTMLValue.cpp +++ b/content/shared/src/nsHTMLValue.cpp @@ -390,7 +390,7 @@ nsHTMLValue::InitializeFrom(const nsHTMLValue& aCopy) PRBool nsHTMLValue::ParseEnumValue(const nsAString& aValue, - EnumTable* aTable, + const EnumTable* aTable, PRBool aCaseSensitive) { nsAutoString val(aValue); @@ -406,7 +406,7 @@ nsHTMLValue::ParseEnumValue(const nsAString& aValue, } PRBool -nsHTMLValue::EnumValueToString(EnumTable* aTable, +nsHTMLValue::EnumValueToString(const EnumTable* aTable, nsAString& aResult) const { if (GetUnit() == eHTMLUnit_Enumerated) { diff --git a/content/xml/document/src/nsXMLContentSink.cpp b/content/xml/document/src/nsXMLContentSink.cpp index 4b44f87d079..15e93af7e3e 100644 --- a/content/xml/document/src/nsXMLContentSink.cpp +++ b/content/xml/document/src/nsXMLContentSink.cpp @@ -110,10 +110,10 @@ // XXX misnamed header file, but oh well #include "nsHTMLTokens.h" -static char kNameSpaceSeparator = ':'; +static const char kNameSpaceSeparator = ':'; #define kXSLType "text/xsl" -static const char* kLoadAsData = "loadAsData"; +static const char kLoadAsData[] = "loadAsData"; static NS_DEFINE_CID(kXMLDocumentCID, NS_XMLDOCUMENT_CID); diff --git a/layout/printing/nsPrintEngine.cpp b/layout/printing/nsPrintEngine.cpp index ad17bffa842..ded0419f961 100644 --- a/layout/printing/nsPrintEngine.cpp +++ b/layout/printing/nsPrintEngine.cpp @@ -95,7 +95,7 @@ static const char sPrintOptionsContractID[] = "@mozilla.org/gfx/printset // Printing Prompts #include "nsIPrintingPromptService.h" -static const char* kPrintingPromptService = "@mozilla.org/embedcomp/printingprompt-service;1"; +static const char kPrintingPromptService[] = "@mozilla.org/embedcomp/printingprompt-service;1"; #define NS_ERROR_GFX_PRINTER_BUNDLE_URL "chrome://global/locale/printing.properties" diff --git a/layout/style/nsCSSScanner.cpp b/layout/style/nsCSSScanner.cpp index a390c81d5ce..065bf81e9be 100644 --- a/layout/style/nsCSSScanner.cpp +++ b/layout/style/nsCSSScanner.cpp @@ -43,10 +43,6 @@ #include "nsString.h" #include "nsCRT.h" -#ifdef NS_DEBUG -static char* kNullPointer = "null pointer"; -#endif - // for #ifdef CSS_REPORT_PARSE_ERRORS #include "nsCOMPtr.h" #include "nsIServiceManager.h" @@ -205,7 +201,7 @@ nsCSSScanner::~nsCSSScanner() void nsCSSScanner::Init(nsIUnicharInputStream* aInput, nsIURI* aURI) { - NS_PRECONDITION(nsnull != aInput, kNullPointer); + NS_PRECONDITION(nsnull != aInput, "Null input stream pointer"); Close(); mInput = aInput; NS_IF_ADDREF(aInput);