Avoid undefined downcasts to wrong type
...CUtList::cDummyElmt is always only of type CUtListElmt, not a derived type. Change-Id: Ibc372642e2a53c548421b5cfa7cc496986036815
This commit is contained in:
@@ -117,7 +117,7 @@ BenError
|
||||
LtcBenContainer::RegisterPropertyName(const char * sPropertyName,
|
||||
pCBenPropertyName * ppPropertyName)
|
||||
{
|
||||
pCBenNamedObjectListElmt pPrevNamedObjectListElmt;
|
||||
pCUtListElmt pPrevNamedObjectListElmt;
|
||||
pCBenNamedObject pNamedObject = FindNamedObject(&cNamedObjects,
|
||||
sPropertyName, &pPrevNamedObjectListElmt);
|
||||
|
||||
@@ -129,7 +129,7 @@ LtcBenContainer::RegisterPropertyName(const char * sPropertyName,
|
||||
}
|
||||
else
|
||||
{
|
||||
pCBenIDListElmt pPrevObject;
|
||||
pCUtListElmt pPrevObject;
|
||||
if (FindID(&cObjects, cNextAvailObjectID, &pPrevObject) != NULL)
|
||||
return BenErr_DuplicateObjectID;
|
||||
|
||||
|
@@ -59,7 +59,7 @@ namespace OpenStormBento
|
||||
|
||||
pCBenNamedObject
|
||||
FindNamedObject(pCUtList pList, const char * sName,
|
||||
pCBenNamedObjectListElmt * ppPrev)
|
||||
pCUtListElmt * ppPrev)
|
||||
{
|
||||
CUtListElmt& rTerminating = pList->GetTerminating();
|
||||
for (pCUtListElmt pCurr = pList->GetLast(); pCurr != &rTerminating;
|
||||
@@ -84,13 +84,13 @@ FindNamedObject(pCUtList pList, const char * sName,
|
||||
}
|
||||
|
||||
if (ppPrev != NULL)
|
||||
*ppPrev = (pCBenNamedObjectListElmt) &rTerminating;
|
||||
*ppPrev = &rTerminating;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
// Assume list is of BenIDListElmt list elements, sorted by ID
|
||||
pCBenIDListElmt
|
||||
FindID(pCUtList pList, BenObjectID ObjectID, pCBenIDListElmt * ppPrev)
|
||||
FindID(pCUtList pList, BenObjectID ObjectID, pCUtListElmt * ppPrev)
|
||||
{
|
||||
CUtListElmt& rTerminating = pList->GetTerminating();
|
||||
for (pCUtListElmt pCurr = pList->GetLast(); pCurr != &rTerminating;
|
||||
@@ -111,7 +111,7 @@ FindID(pCUtList pList, BenObjectID ObjectID, pCBenIDListElmt * ppPrev)
|
||||
}
|
||||
|
||||
if (ppPrev != NULL)
|
||||
*ppPrev = (pCBenIDListElmt) &rTerminating;
|
||||
*ppPrev = &rTerminating;
|
||||
return NULL;
|
||||
}
|
||||
} //end namespace OpenStormBento
|
||||
|
@@ -59,7 +59,7 @@ namespace OpenStormBento
|
||||
// changed to remove warning
|
||||
CBenNamedObject::CBenNamedObject(pLtcBenContainer pContainer,
|
||||
BenObjectID ObjectID, pCBenObject pPrevObject, const char * sName,
|
||||
pCBenNamedObjectListElmt pPrevNamedObjectListElmt)
|
||||
pCUtListElmt pPrevNamedObjectListElmt)
|
||||
: CBenObject(pContainer, ObjectID, pPrevObject)
|
||||
, csName(sName)
|
||||
, cNameListElmt(pPrevNamedObjectListElmt)
|
||||
|
@@ -66,7 +66,7 @@ CBenObject::IsNamedObject()
|
||||
pCBenProperty
|
||||
CBenObject::UseProperty(BenObjectID PropertyID)
|
||||
{
|
||||
pCBenIDListElmt pPrev;
|
||||
pCUtListElmt pPrev;
|
||||
return (pCBenProperty) FindID(&cProperties, PropertyID, &pPrev);
|
||||
}
|
||||
|
||||
|
@@ -144,7 +144,7 @@ sal_uLong BenOpenContainer(LwpSvStream * pStream, pLtcBenContainer * ppContainer
|
||||
class CBenIDListElmt : public CUtListElmt
|
||||
{
|
||||
public: // Internal methods
|
||||
CBenIDListElmt(BenObjectID ID, pCBenIDListElmt pPrev) : CUtListElmt(pPrev)
|
||||
CBenIDListElmt(BenObjectID ID, pCUtListElmt pPrev) : CUtListElmt(pPrev)
|
||||
{ cID = ID; }
|
||||
CBenIDListElmt(BenObjectID ID) { cID = ID; }
|
||||
BenObjectID GetID() { return cID; }
|
||||
@@ -157,7 +157,7 @@ class CBenNamedObjectListElmt : public CUtListElmt
|
||||
{
|
||||
public: // Methods
|
||||
// added to remove warning
|
||||
CBenNamedObjectListElmt(pCBenNamedObjectListElmt pPrev) : CUtListElmt(pPrev)
|
||||
CBenNamedObjectListElmt(pCUtListElmt pPrev) : CUtListElmt(pPrev)
|
||||
{ cpNamedObject = NULL; }
|
||||
void SetNamedObject(pCBenNamedObject pObj)
|
||||
{
|
||||
@@ -255,7 +255,7 @@ public:
|
||||
BenObjectID GetObjectID() { return GetID(); }
|
||||
public: // Internal methods
|
||||
CBenObject(pLtcBenContainer pContainer, BenObjectID ObjectID,
|
||||
pCBenIDListElmt pPrev) : CBenIDListElmt(ObjectID, pPrev)
|
||||
pCUtListElmt pPrev) : CBenIDListElmt(ObjectID, pPrev)
|
||||
{ cpContainer = pContainer; }
|
||||
CUtList& GetProperties() { return cProperties; }
|
||||
|
||||
@@ -320,7 +320,7 @@ public:
|
||||
public: // Internal methods
|
||||
// changed to remove WARNING here
|
||||
CBenProperty(pCBenObject pObject, BenObjectID PropertyID,
|
||||
BenObjectID TypeID, pCBenIDListElmt pPrevProperty) :
|
||||
BenObjectID TypeID, pCUtListElmt pPrevProperty) :
|
||||
CBenIDListElmt(PropertyID, pPrevProperty), cValue(TypeID)
|
||||
{
|
||||
cpObject = pObject;
|
||||
@@ -403,7 +403,7 @@ public: // Methods
|
||||
public: // Internal methods
|
||||
CBenNamedObject(pLtcBenContainer pContainer, BenObjectID ObjectID,
|
||||
pCBenObject pPrevObject, const char * sName,
|
||||
pCBenNamedObjectListElmt pPrevNamedObjectListElmt);
|
||||
pCUtListElmt pPrevNamedObjectListElmt);
|
||||
const char * GetName() { return csName.data(); }
|
||||
|
||||
const char * GetNameCStr() { return csName.c_str(); }
|
||||
@@ -424,7 +424,7 @@ class CBenPropertyName : public CBenNamedObject
|
||||
public: // Internal methods
|
||||
CBenPropertyName(pLtcBenContainer pContainer, BenObjectID ObjectID,
|
||||
pCBenObject pPrevObject, const char * sName,
|
||||
pCBenNamedObjectListElmt pPrevNamedObjectListElmt) :
|
||||
pCUtListElmt pPrevNamedObjectListElmt) :
|
||||
CBenNamedObject(pContainer, ObjectID, pPrevObject, sName,
|
||||
pPrevNamedObjectListElmt) { ; }
|
||||
virtual bool IsPropertyName() SAL_OVERRIDE;
|
||||
@@ -435,7 +435,7 @@ class CBenTypeName : public CBenNamedObject
|
||||
public: // Internal methods
|
||||
CBenTypeName(pLtcBenContainer pContainer, BenObjectID ObjectID,
|
||||
pCBenObject pPrevObject, const char * sName,
|
||||
pCBenNamedObjectListElmt pPrevNamedObjectListElmt) :
|
||||
pCUtListElmt pPrevNamedObjectListElmt) :
|
||||
CBenNamedObject(pContainer, ObjectID, pPrevObject, sName,
|
||||
pPrevNamedObjectListElmt) { ; }
|
||||
virtual bool IsTypeName() SAL_OVERRIDE;
|
||||
|
@@ -68,10 +68,10 @@ typedef BenByte * BenByteDataPtr;
|
||||
typedef const BenByte * BenConstByteDataPtr;
|
||||
|
||||
pCBenNamedObject FindNamedObject(pCUtList pList, const char * sName,
|
||||
pCBenNamedObjectListElmt * ppPrev);
|
||||
pCUtListElmt * ppPrev);
|
||||
|
||||
pCBenIDListElmt FindID(pCUtList pList, BenObjectID ObjectID,
|
||||
pCBenIDListElmt * ppPrev);
|
||||
pCUtListElmt * ppPrev);
|
||||
} // end namespace
|
||||
|
||||
// Private headers
|
||||
|
@@ -287,7 +287,7 @@ CBenTOCReader::ReadTOC()
|
||||
return Err;
|
||||
}
|
||||
|
||||
pCBenNamedObjectListElmt pPrevNamedObjectListElmt;
|
||||
pCUtListElmt pPrevNamedObjectListElmt;
|
||||
if (FindNamedObject(&cpContainer->GetNamedObjects(),
|
||||
sBuffer, &pPrevNamedObjectListElmt) != NULL)
|
||||
{
|
||||
@@ -342,10 +342,10 @@ CBenTOCReader::ReadTOC()
|
||||
|
||||
if (pObject == NULL)
|
||||
pObject = new CBenObject(cpContainer, ObjectID,
|
||||
(pCBenObject) cpContainer->GetObjects().GetLast());
|
||||
cpContainer->GetObjects().GetLast());
|
||||
|
||||
pProperty = new CBenProperty(pObject, PropertyID, TypeID,
|
||||
(pCBenProperty) pObject->GetProperties().GetLast());
|
||||
pObject->GetProperties().GetLast());
|
||||
|
||||
if ((Err = ReadSegments(&pProperty->UseValue(),
|
||||
&LookAhead)) != BenErr_OK)
|
||||
|
Reference in New Issue
Block a user