Make some static data const in content. Bug 204532, patch by ataylor@its.to

(Andrew Taylor), r=bzbarsky, sr=alecf
This commit is contained in:
bzbarsky%mit.edu 2003-05-27 03:49:22 +00:00
Родитель 1ec4879a62
Коммит 2d8c24058a
26 изменённых файлов: 49 добавлений и 57 удалений

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

@ -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;

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

@ -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,

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

@ -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[] = {
"", "", "", "", "", "", "", "", "", "",
"", "", "", "", "", "", "", "", "", "",

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

@ -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) {

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

@ -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;
/**

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

@ -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"

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

@ -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);

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

@ -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[] = {
"", "", "", "", "", "", "", "", "", "",
"", "", "", "", "", "", "", "", "", "",

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

@ -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 },

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

@ -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 },

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

@ -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)) {

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

@ -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 },

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

@ -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 },

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

@ -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)) {

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

@ -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 },

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

@ -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 },

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

@ -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},

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

@ -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},

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

@ -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 },

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

@ -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 }

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

@ -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);

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

@ -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;
/**

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

@ -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) {

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

@ -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);

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

@ -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"

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

@ -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);