Closed
Bug 1887
Opened 26 years ago
Closed 26 years ago
Unix compilers don't like taking address of automatics (patch)
Categories
(Core :: Layout, defect, P2)
Tracking
()
VERIFIED
FIXED
People
(Reporter: tor, Assigned: peterl-retired)
Details
(Whiteboard: mar 26, still awaiting permission to verify)
In a couple of places in the layout code, you create automatic objects
in a method call and attempt to take the address of the object. Some
unix compilers object to this, complaining that the object in question
is not a variable or a l-value. This patch fixes these problems:
Index: base/src/nsNameSpaceManager.cpp
===================================================================
RCS file: /cvsroot/mozilla/layout/base/src/nsNameSpaceManager.cpp,v
retrieving revision 3.1
diff -u -r3.1 nsNameSpaceManager.cpp
--- nsNameSpaceManager.cpp 1998/12/11 02:35:06 3.1
+++ nsNameSpaceManager.cpp 1998/12/12 17:12:30
@@ -271,8 +271,10 @@
nsString* xml = new nsString(kXMLNameSpaceURI);
gURIArray->AppendElement(html);
gURIArray->AppendElement(xml);
- gURIToIDTable->Put(&StringKey(html), (void*)kNameSpaceID_HTML);
- gURIToIDTable->Put(&StringKey(xml), (void*)kNameSpaceID_XML);
+ StringKey htmlKey(html);
+ StringKey xmlKey(xml);
+ gURIToIDTable->Put(&htmlKey, (void*)kNameSpaceID_HTML);
+ gURIToIDTable->Put(&xmlKey, (void*)kNameSpaceID_XML);
}
NS_ASSERTION(nsnull != gURIToIDTable, "no URI table");
NS_ASSERTION(nsnull != gURIArray, "no URI array");
@@ -296,7 +298,8 @@
static PRInt32 FindNameSpaceID(const nsString& aURI)
{
NS_ASSERTION(nsnull != gURIToIDTable, "no URI table");
- void* value = gURIToIDTable->Get(&StringKey(&aURI));
+ StringKey key(&aURI);
+ void* value = gURIToIDTable->Get(&key);
if (nsnull != value) {
return PRInt32(value);
}
@@ -376,7 +379,8 @@
nsString* uri = new nsString(aURI);
gURIArray->AppendElement(uri);
id = gURIArray->Count(); // id is index + 1
- gURIToIDTable->Put(&StringKey(uri), (void*)id);
+ StringKey key(uri);
+ gURIToIDTable->Put(&key, (void*)id);
}
aNameSpaceID = id;
return NS_OK;
Index: html/style/src/nsCSSStyleSheet.cpp
===================================================================
RCS file: /cvsroot/mozilla/layout/html/style/src/nsCSSStyleSheet.cpp,v
retrieving revision 3.36
diff -u -r3.36 nsCSSStyleSheet.cpp
--- nsCSSStyleSheet.cpp 1998/12/11 02:50:43 3.36
+++ nsCSSStyleSheet.cpp 1998/12/12 17:12:31
@@ -247,26 +247,30 @@
PRInt32 valueCount = 0;
{ // universal tag rules
- RuleValue* value =
(RuleValue*)mTagTable.Get(&RuleKey(nsCSSAtoms::universalSelector));
+ RuleKey key(nsCSSAtoms::universalSelector);
+ RuleValue* value = (RuleValue*)mTagTable.Get(&key);
if (nsnull != value) {
mEnumList[valueCount++] = value;
}
}
if (nsnull != aTag) {
- RuleValue* value = (RuleValue*)mTagTable.Get(&RuleKey(aTag));
+ RuleKey key(aTag);
+ RuleValue* value = (RuleValue*)mTagTable.Get(&key);
if (nsnull != value) {
mEnumList[valueCount++] = value;
}
}
if (nsnull != aID) {
- RuleValue* value = (RuleValue*)mIdTable.Get(&RuleKey(aID));
+ RuleKey key(aID);
+ RuleValue* value = (RuleValue*)mIdTable.Get(&key);
if (nsnull != value) {
mEnumList[valueCount++] = value;
}
}
for (index = 0; index < classCount; index++) {
nsIAtom* classAtom = (nsIAtom*)aClassList.ElementAt(index);
- RuleValue* value = (RuleValue*)mClassTable.Get(&RuleKey(classAtom));
+ RuleKey key(classAtom);
+ RuleValue* value = (RuleValue*)mClassTable.Get(&key);
if (nsnull != value) {
mEnumList[valueCount++] = value;
}
@@ -306,8 +310,10 @@
void RuleHash::EnumerateTagRules(nsIAtom* aTag, RuleEnumFunc aFunc, void*
aData)
{
- RuleValue* tagValue = (RuleValue*)mTagTable.Get(&RuleKey(aTag));
- RuleValue* uniValue =
(RuleValue*)mTagTable.Get(&RuleKey(nsCSSAtoms::universalSelector));
+ RuleKey aTagKey(aTag);
+ RuleKey universalKey(nsCSSAtoms::universalSelector);
+ RuleValue* tagValue = (RuleValue*)mTagTable.Get(&aTagKey);
+ RuleValue* uniValue = (RuleValue*)mTagTable.Get(&universalKey);
if (nsnull == tagValue) {
if (nsnull != uniValue) {
Assignee | ||
Updated•26 years ago
|
Status: NEW → RESOLVED
Closed: 26 years ago
Resolution: --- → FIXED
Updated•26 years ago
|
QA Contact: 4120
Comment 1•26 years ago
|
||
Tor, could you provide a test case for this that would suitably illustrate the
bug? Thanks!
This problem has already been fixed in the mozilla tree, but here's
a quick little example of the problem. The AIX, Sun, and SGI native
compilers will all give an error complaining about taking the address
of a temporary.
class Foo {
public:
Foo(int n);
};
void bar(Foo *foo);
int main(int argc, char **argv) {
bar(&Foo(42));
return 0;
}
Updated•26 years ago
|
QA Contact: 4120 → 4078
Tor, this is a low level fix. if the AIX, SGI, and Sun compilers don't
complain anymore could you mark this verified?
thanks!
i'm marking this verified. if you have any objections, please reopen.
You need to log in
before you can comment on or make changes to this bug.
Description
•