| | | | Browse by category |
Article ID: 489
Last updated: 16 Apr, 2018
Problem
CGXUserAttribute::IsEqual(...) incorrectly compares the user attribute to itself for all values types except strings.
Cause
Action
Here is how to replace the method in gxstyuai.cpp:
// Comparision BOOL CGXUserAttribute::IsEqual(const CGXAbstractUserAttribute& pOther) const { |
|||
// First check ID so that we know // this is the same attribute type if (pOther.m_nId != m_nId) |
|||
return FALSE; | |||
// Now it is safe to assume that // pOther is also a CGXUserAttribute CGXUserAttribute& p = (CGXUserAttribute&) pOther; if (m_vtType != p.m_vtType) |
|||
return FALSE; | |||
switch (m_vtType) { case vtEmpty: |
|||
return TRUE; | |||
case vtDWord: | |||
return p.m_value.dwValue == m_value.dwValue; | |||
case vtLong: | |||
return p.m_value.lValue == m_value.lValue; | |||
case vtShortString: case vtString: |
|||
Cstring s = GetValue(); return s.Compare(p.GetValue()) == 0; |
|||
case vtDouble: | |||
return p.m_value.dValue == m_value.dValue; | |||
case vtByte8: | |||
return memcmp(&p.m_value.b8Value, &m_value.b8Value, 8) == 0; | |||
default: | |||
return FALSE; | |||
} | |||
} |
This article was:
Helpful |
Not helpful
Report an issue
Article ID: 489
Last updated: 16 Apr, 2018
Revision: 3
Views: 1689
Posted: 12 Jan, 2001 by
Meltreger B.
Updated: 16 Apr, 2018 by
Meltreger B.
Others in this category
Powered by KBPublisher (Knowledge base software)