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