Bug 1352082 - Avoid shifting a signed integer left in C++. r=wchen
MozReview-Commit-ID: 52YqyHAz2c3
This commit is contained in:
@@ -1,22 +1,22 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 2008-2011 Mozilla Foundation
|
* Copyright (c) 2008-2011 Mozilla Foundation
|
||||||
*
|
*
|
||||||
* Permission is hereby granted, free of charge, to any person obtaining a
|
* Permission is hereby granted, free of charge, to any person obtaining a
|
||||||
* copy of this software and associated documentation files (the "Software"),
|
* copy of this software and associated documentation files (the "Software"),
|
||||||
* to deal in the Software without restriction, including without limitation
|
* to deal in the Software without restriction, including without limitation
|
||||||
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||||
* and/or sell copies of the Software, and to permit persons to whom the
|
* and/or sell copies of the Software, and to permit persons to whom the
|
||||||
* Software is furnished to do so, subject to the following conditions:
|
* Software is furnished to do so, subject to the following conditions:
|
||||||
*
|
*
|
||||||
* The above copyright notice and this permission notice shall be included in
|
* The above copyright notice and this permission notice shall be included in
|
||||||
* all copies or substantial portions of the Software.
|
* all copies or substantial portions of the Software.
|
||||||
*
|
*
|
||||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
||||||
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||||
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||||
* DEALINGS IN THE SOFTWARE.
|
* DEALINGS IN THE SOFTWARE.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@@ -29,6 +29,7 @@ import nu.validator.htmlparser.annotation.NoLength;
|
|||||||
import nu.validator.htmlparser.annotation.NsUri;
|
import nu.validator.htmlparser.annotation.NsUri;
|
||||||
import nu.validator.htmlparser.annotation.Prefix;
|
import nu.validator.htmlparser.annotation.Prefix;
|
||||||
import nu.validator.htmlparser.annotation.QName;
|
import nu.validator.htmlparser.annotation.QName;
|
||||||
|
import nu.validator.htmlparser.annotation.Unsigned;
|
||||||
import nu.validator.htmlparser.annotation.Virtual;
|
import nu.validator.htmlparser.annotation.Virtual;
|
||||||
import nu.validator.htmlparser.common.Interner;
|
import nu.validator.htmlparser.common.Interner;
|
||||||
|
|
||||||
@@ -51,7 +52,7 @@ public final class AttributeName
|
|||||||
public static final int BOOLEAN = (1 << 6);
|
public static final int BOOLEAN = (1 << 6);
|
||||||
|
|
||||||
// ]NOCPP]
|
// ]NOCPP]
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* An array representing no namespace regardless of namespace mode (HTML,
|
* An array representing no namespace regardless of namespace mode (HTML,
|
||||||
* SVG, MathML, lang-mapping HTML) used.
|
* SVG, MathML, lang-mapping HTML) used.
|
||||||
@@ -170,7 +171,7 @@ public final class AttributeName
|
|||||||
/**
|
/**
|
||||||
* An initialization helper for having a one name in the SVG mode and
|
* An initialization helper for having a one name in the SVG mode and
|
||||||
* another name in the other modes.
|
* another name in the other modes.
|
||||||
*
|
*
|
||||||
* @param name
|
* @param name
|
||||||
* the name for the non-SVG modes
|
* the name for the non-SVG modes
|
||||||
* @param camel
|
* @param camel
|
||||||
@@ -192,7 +193,7 @@ public final class AttributeName
|
|||||||
/**
|
/**
|
||||||
* An initialization helper for having a one name in the MathML mode and
|
* An initialization helper for having a one name in the MathML mode and
|
||||||
* another name in the other modes.
|
* another name in the other modes.
|
||||||
*
|
*
|
||||||
* @param name
|
* @param name
|
||||||
* the name for the non-MathML modes
|
* the name for the non-MathML modes
|
||||||
* @param camel
|
* @param camel
|
||||||
@@ -214,7 +215,7 @@ public final class AttributeName
|
|||||||
/**
|
/**
|
||||||
* An initialization helper for having a different local name in the HTML
|
* An initialization helper for having a different local name in the HTML
|
||||||
* mode and the SVG and MathML modes.
|
* mode and the SVG and MathML modes.
|
||||||
*
|
*
|
||||||
* @param name
|
* @param name
|
||||||
* the name for the HTML mode
|
* the name for the HTML mode
|
||||||
* @param suffix
|
* @param suffix
|
||||||
@@ -235,7 +236,7 @@ public final class AttributeName
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* An initialization helper for having the same local name in all modes.
|
* An initialization helper for having the same local name in all modes.
|
||||||
*
|
*
|
||||||
* @param name
|
* @param name
|
||||||
* the name
|
* the name
|
||||||
* @return the initialized name array
|
* @return the initialized name array
|
||||||
@@ -253,12 +254,12 @@ public final class AttributeName
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns an attribute name by buffer.
|
* Returns an attribute name by buffer.
|
||||||
*
|
*
|
||||||
* <p>
|
* <p>
|
||||||
* C++ ownership: The return value is either released by the caller if the
|
* C++ ownership: The return value is either released by the caller if the
|
||||||
* attribute is a duplicate or the ownership is transferred to
|
* attribute is a duplicate or the ownership is transferred to
|
||||||
* HtmlAttributes and released upon clearing or destroying that object.
|
* HtmlAttributes and released upon clearing or destroying that object.
|
||||||
*
|
*
|
||||||
* @param buf
|
* @param buf
|
||||||
* the buffer
|
* the buffer
|
||||||
* @param offset
|
* @param offset
|
||||||
@@ -276,7 +277,7 @@ public final class AttributeName
|
|||||||
// ]NOCPP]
|
// ]NOCPP]
|
||||||
, Interner interner) {
|
, Interner interner) {
|
||||||
// XXX deal with offset
|
// XXX deal with offset
|
||||||
int hash = AttributeName.bufToHash(buf, length);
|
@Unsigned int hash = AttributeName.bufToHash(buf, length);
|
||||||
int index = Arrays.binarySearch(AttributeName.ATTRIBUTE_HASHES, hash);
|
int index = Arrays.binarySearch(AttributeName.ATTRIBUTE_HASHES, hash);
|
||||||
if (index < 0) {
|
if (index < 0) {
|
||||||
return AttributeName.createAttributeName(
|
return AttributeName.createAttributeName(
|
||||||
@@ -305,14 +306,14 @@ public final class AttributeName
|
|||||||
/**
|
/**
|
||||||
* This method has to return a unique integer for each well-known
|
* This method has to return a unique integer for each well-known
|
||||||
* lower-cased attribute name.
|
* lower-cased attribute name.
|
||||||
*
|
*
|
||||||
* @param buf
|
* @param buf
|
||||||
* @param len
|
* @param len
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
private static int bufToHash(@NoLength char[] buf, int len) {
|
private static @Unsigned int bufToHash(@NoLength char[] buf, int len) {
|
||||||
int hash2 = 0;
|
@Unsigned int hash2 = 0;
|
||||||
int hash = len;
|
@Unsigned int hash = len;
|
||||||
hash <<= 5;
|
hash <<= 5;
|
||||||
hash += buf[0] - 0x60;
|
hash += buf[0] - 0x60;
|
||||||
int j = len;
|
int j = len;
|
||||||
@@ -378,7 +379,7 @@ public final class AttributeName
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* The startup-time constructor.
|
* The startup-time constructor.
|
||||||
*
|
*
|
||||||
* @param uri
|
* @param uri
|
||||||
* the namespace
|
* the namespace
|
||||||
* @param local
|
* @param local
|
||||||
@@ -394,7 +395,7 @@ public final class AttributeName
|
|||||||
@Local @NoLength String[] local, @Prefix @NoLength String[] prefix
|
@Local @NoLength String[] local, @Prefix @NoLength String[] prefix
|
||||||
// [NOCPP[
|
// [NOCPP[
|
||||||
, int flags
|
, int flags
|
||||||
// ]NOCPP]
|
// ]NOCPP]
|
||||||
) {
|
) {
|
||||||
this.uri = uri;
|
this.uri = uri;
|
||||||
this.local = local;
|
this.local = local;
|
||||||
@@ -407,7 +408,7 @@ public final class AttributeName
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates an <code>AttributeName</code> for a local name.
|
* Creates an <code>AttributeName</code> for a local name.
|
||||||
*
|
*
|
||||||
* @param name
|
* @param name
|
||||||
* the name
|
* the name
|
||||||
* @param checkNcName
|
* @param checkNcName
|
||||||
@@ -449,7 +450,7 @@ public final class AttributeName
|
|||||||
/**
|
/**
|
||||||
* Clones the attribute using an interner. Returns <code>this</code> in Java
|
* Clones the attribute using an interner. Returns <code>this</code> in Java
|
||||||
* and for non-dynamic instances in C++.
|
* and for non-dynamic instances in C++.
|
||||||
*
|
*
|
||||||
* @param interner
|
* @param interner
|
||||||
* an interner
|
* an interner
|
||||||
* @return a clone
|
* @return a clone
|
||||||
@@ -462,7 +463,7 @@ public final class AttributeName
|
|||||||
/**
|
/**
|
||||||
* Creator for use when the XML violation policy requires an attribute name
|
* Creator for use when the XML violation policy requires an attribute name
|
||||||
* to be changed.
|
* to be changed.
|
||||||
*
|
*
|
||||||
* @param name
|
* @param name
|
||||||
* the name of the attribute to create
|
* the name of the attribute to create
|
||||||
*/
|
*/
|
||||||
@@ -474,7 +475,7 @@ public final class AttributeName
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Queries whether this name is an XML 1.0 4th ed. NCName.
|
* Queries whether this name is an XML 1.0 4th ed. NCName.
|
||||||
*
|
*
|
||||||
* @param mode
|
* @param mode
|
||||||
* the SVG/MathML/HTML mode
|
* the SVG/MathML/HTML mode
|
||||||
* @return <code>true</code> if this is an NCName in the given mode
|
* @return <code>true</code> if this is an NCName in the given mode
|
||||||
@@ -485,17 +486,17 @@ public final class AttributeName
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Queries whether this is an <code>xmlns</code> attribute.
|
* Queries whether this is an <code>xmlns</code> attribute.
|
||||||
*
|
*
|
||||||
* @return <code>true</code> if this is an <code>xmlns</code> attribute
|
* @return <code>true</code> if this is an <code>xmlns</code> attribute
|
||||||
*/
|
*/
|
||||||
public boolean isXmlns() {
|
public boolean isXmlns() {
|
||||||
return (flags & IS_XMLNS) != 0;
|
return (flags & IS_XMLNS) != 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Queries whether this attribute has a case-folded value in the HTML4 mode
|
* Queries whether this attribute has a case-folded value in the HTML4 mode
|
||||||
* of the parser.
|
* of the parser.
|
||||||
*
|
*
|
||||||
* @return <code>true</code> if the value is case-folded
|
* @return <code>true</code> if the value is case-folded
|
||||||
*/
|
*/
|
||||||
boolean isCaseFolded() {
|
boolean isCaseFolded() {
|
||||||
|
|||||||
@@ -27,6 +27,7 @@ import java.util.Arrays;
|
|||||||
import nu.validator.htmlparser.annotation.Inline;
|
import nu.validator.htmlparser.annotation.Inline;
|
||||||
import nu.validator.htmlparser.annotation.Local;
|
import nu.validator.htmlparser.annotation.Local;
|
||||||
import nu.validator.htmlparser.annotation.NoLength;
|
import nu.validator.htmlparser.annotation.NoLength;
|
||||||
|
import nu.validator.htmlparser.annotation.Unsigned;
|
||||||
import nu.validator.htmlparser.annotation.Virtual;
|
import nu.validator.htmlparser.annotation.Virtual;
|
||||||
import nu.validator.htmlparser.common.Interner;
|
import nu.validator.htmlparser.common.Interner;
|
||||||
|
|
||||||
@@ -108,7 +109,7 @@ public final class ElementName
|
|||||||
}
|
}
|
||||||
|
|
||||||
static ElementName elementNameByBuffer(@NoLength char[] buf, int offset, int length, Interner interner) {
|
static ElementName elementNameByBuffer(@NoLength char[] buf, int offset, int length, Interner interner) {
|
||||||
int hash = ElementName.bufToHash(buf, length);
|
@Unsigned int hash = ElementName.bufToHash(buf, length);
|
||||||
int index = Arrays.binarySearch(ElementName.ELEMENT_HASHES, hash);
|
int index = Arrays.binarySearch(ElementName.ELEMENT_HASHES, hash);
|
||||||
if (index < 0) {
|
if (index < 0) {
|
||||||
return new ElementName(Portability.newLocalNameFromBuffer(buf, offset, length, interner));
|
return new ElementName(Portability.newLocalNameFromBuffer(buf, offset, length, interner));
|
||||||
@@ -131,8 +132,8 @@ public final class ElementName
|
|||||||
* @param len
|
* @param len
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
private static int bufToHash(@NoLength char[] buf, int len) {
|
private static @Unsigned int bufToHash(@NoLength char[] buf, int len) {
|
||||||
int hash = len;
|
@Unsigned int hash = len;
|
||||||
hash <<= 5;
|
hash <<= 5;
|
||||||
hash += buf[0] - 0x60;
|
hash += buf[0] - 0x60;
|
||||||
int j = len;
|
int j = len;
|
||||||
|
|||||||
@@ -1,22 +1,22 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 2008-2011 Mozilla Foundation
|
* Copyright (c) 2008-2011 Mozilla Foundation
|
||||||
*
|
*
|
||||||
* Permission is hereby granted, free of charge, to any person obtaining a
|
* Permission is hereby granted, free of charge, to any person obtaining a
|
||||||
* copy of this software and associated documentation files (the "Software"),
|
* copy of this software and associated documentation files (the "Software"),
|
||||||
* to deal in the Software without restriction, including without limitation
|
* to deal in the Software without restriction, including without limitation
|
||||||
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||||
* and/or sell copies of the Software, and to permit persons to whom the
|
* and/or sell copies of the Software, and to permit persons to whom the
|
||||||
* Software is furnished to do so, subject to the following conditions:
|
* Software is furnished to do so, subject to the following conditions:
|
||||||
*
|
*
|
||||||
* The above copyright notice and this permission notice shall be included in
|
* The above copyright notice and this permission notice shall be included in
|
||||||
* all copies or substantial portions of the Software.
|
* all copies or substantial portions of the Software.
|
||||||
*
|
*
|
||||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
||||||
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||||
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||||
* DEALINGS IN THE SOFTWARE.
|
* DEALINGS IN THE SOFTWARE.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@@ -106,7 +106,7 @@ nsHtml5AttributeName::SAME_LOCAL(nsIAtom* name)
|
|||||||
nsHtml5AttributeName*
|
nsHtml5AttributeName*
|
||||||
nsHtml5AttributeName::nameByBuffer(char16_t* buf, int32_t offset, int32_t length, nsHtml5AtomTable* interner)
|
nsHtml5AttributeName::nameByBuffer(char16_t* buf, int32_t offset, int32_t length, nsHtml5AtomTable* interner)
|
||||||
{
|
{
|
||||||
int32_t hash = nsHtml5AttributeName::bufToHash(buf, length);
|
uint32_t hash = nsHtml5AttributeName::bufToHash(buf, length);
|
||||||
int32_t index = nsHtml5AttributeName::ATTRIBUTE_HASHES.binarySearch(hash);
|
int32_t index = nsHtml5AttributeName::ATTRIBUTE_HASHES.binarySearch(hash);
|
||||||
if (index < 0) {
|
if (index < 0) {
|
||||||
return nsHtml5AttributeName::createAttributeName(nsHtml5Portability::newLocalNameFromBuffer(buf, offset, length, interner));
|
return nsHtml5AttributeName::createAttributeName(nsHtml5Portability::newLocalNameFromBuffer(buf, offset, length, interner));
|
||||||
@@ -120,11 +120,11 @@ nsHtml5AttributeName::nameByBuffer(char16_t* buf, int32_t offset, int32_t length
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
int32_t
|
uint32_t
|
||||||
nsHtml5AttributeName::bufToHash(char16_t* buf, int32_t len)
|
nsHtml5AttributeName::bufToHash(char16_t* buf, int32_t len)
|
||||||
{
|
{
|
||||||
int32_t hash2 = 0;
|
uint32_t hash2 = 0;
|
||||||
int32_t hash = len;
|
uint32_t hash = len;
|
||||||
hash <<= 5;
|
hash <<= 5;
|
||||||
hash += buf[0] - 0x60;
|
hash += buf[0] - 0x60;
|
||||||
int32_t j = len;
|
int32_t j = len;
|
||||||
|
|||||||
@@ -1,22 +1,22 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 2008-2011 Mozilla Foundation
|
* Copyright (c) 2008-2011 Mozilla Foundation
|
||||||
*
|
*
|
||||||
* Permission is hereby granted, free of charge, to any person obtaining a
|
* Permission is hereby granted, free of charge, to any person obtaining a
|
||||||
* copy of this software and associated documentation files (the "Software"),
|
* copy of this software and associated documentation files (the "Software"),
|
||||||
* to deal in the Software without restriction, including without limitation
|
* to deal in the Software without restriction, including without limitation
|
||||||
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||||
* and/or sell copies of the Software, and to permit persons to whom the
|
* and/or sell copies of the Software, and to permit persons to whom the
|
||||||
* Software is furnished to do so, subject to the following conditions:
|
* Software is furnished to do so, subject to the following conditions:
|
||||||
*
|
*
|
||||||
* The above copyright notice and this permission notice shall be included in
|
* The above copyright notice and this permission notice shall be included in
|
||||||
* all copies or substantial portions of the Software.
|
* all copies or substantial portions of the Software.
|
||||||
*
|
*
|
||||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
||||||
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||||
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||||
* DEALINGS IN THE SOFTWARE.
|
* DEALINGS IN THE SOFTWARE.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@@ -76,7 +76,7 @@ class nsHtml5AttributeName
|
|||||||
static nsIAtom** SAME_LOCAL(nsIAtom* name);
|
static nsIAtom** SAME_LOCAL(nsIAtom* name);
|
||||||
static nsHtml5AttributeName* nameByBuffer(char16_t* buf, int32_t offset, int32_t length, nsHtml5AtomTable* interner);
|
static nsHtml5AttributeName* nameByBuffer(char16_t* buf, int32_t offset, int32_t length, nsHtml5AtomTable* interner);
|
||||||
private:
|
private:
|
||||||
static int32_t bufToHash(char16_t* buf, int32_t len);
|
static uint32_t bufToHash(char16_t* buf, int32_t len);
|
||||||
int32_t* uri;
|
int32_t* uri;
|
||||||
nsIAtom** local;
|
nsIAtom** local;
|
||||||
nsIAtom** prefix;
|
nsIAtom** prefix;
|
||||||
|
|||||||
@@ -71,7 +71,7 @@ nsHtml5ElementName::isCustom()
|
|||||||
nsHtml5ElementName*
|
nsHtml5ElementName*
|
||||||
nsHtml5ElementName::elementNameByBuffer(char16_t* buf, int32_t offset, int32_t length, nsHtml5AtomTable* interner)
|
nsHtml5ElementName::elementNameByBuffer(char16_t* buf, int32_t offset, int32_t length, nsHtml5AtomTable* interner)
|
||||||
{
|
{
|
||||||
int32_t hash = nsHtml5ElementName::bufToHash(buf, length);
|
uint32_t hash = nsHtml5ElementName::bufToHash(buf, length);
|
||||||
int32_t index = nsHtml5ElementName::ELEMENT_HASHES.binarySearch(hash);
|
int32_t index = nsHtml5ElementName::ELEMENT_HASHES.binarySearch(hash);
|
||||||
if (index < 0) {
|
if (index < 0) {
|
||||||
return new nsHtml5ReleasableElementName(nsHtml5Portability::newLocalNameFromBuffer(buf, offset, length, interner));
|
return new nsHtml5ReleasableElementName(nsHtml5Portability::newLocalNameFromBuffer(buf, offset, length, interner));
|
||||||
@@ -85,10 +85,10 @@ nsHtml5ElementName::elementNameByBuffer(char16_t* buf, int32_t offset, int32_t l
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
int32_t
|
uint32_t
|
||||||
nsHtml5ElementName::bufToHash(char16_t* buf, int32_t len)
|
nsHtml5ElementName::bufToHash(char16_t* buf, int32_t len)
|
||||||
{
|
{
|
||||||
int32_t hash = len;
|
uint32_t hash = len;
|
||||||
hash <<= 5;
|
hash <<= 5;
|
||||||
hash += buf[0] - 0x60;
|
hash += buf[0] - 0x60;
|
||||||
int32_t j = len;
|
int32_t j = len;
|
||||||
|
|||||||
@@ -71,7 +71,7 @@ class nsHtml5ElementName
|
|||||||
bool isCustom();
|
bool isCustom();
|
||||||
static nsHtml5ElementName* elementNameByBuffer(char16_t* buf, int32_t offset, int32_t length, nsHtml5AtomTable* interner);
|
static nsHtml5ElementName* elementNameByBuffer(char16_t* buf, int32_t offset, int32_t length, nsHtml5AtomTable* interner);
|
||||||
private:
|
private:
|
||||||
static int32_t bufToHash(char16_t* buf, int32_t len);
|
static uint32_t bufToHash(char16_t* buf, int32_t len);
|
||||||
nsHtml5ElementName(nsIAtom* name, nsIAtom* camelCaseName, int32_t flags);
|
nsHtml5ElementName(nsIAtom* name, nsIAtom* camelCaseName, int32_t flags);
|
||||||
protected:
|
protected:
|
||||||
explicit nsHtml5ElementName(nsIAtom* name);
|
explicit nsHtml5ElementName(nsIAtom* name);
|
||||||
|
|||||||
Reference in New Issue
Block a user