[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

A couple of places where const_cast is needed



I notice that a number of methods in SFL 2.3 have gained const
parameters or return values which were not defined as const in SFL 2.1. 
Whilst this is generally an improvement, there are a couple of places
where it has not been applied consistently, so I have to resort to using
const_cast to cast to non-const values:

1. Methods such as CSM_MsgToVerify::AccessEncapContentClear() return
   a const CSM_Content* pointer.  To extract the data from this I
   have to cast the member m_content to a non-const CSM_Buffer*
   pointer, because none of CSM_Buffer::Open(), CSM_Buffer::cRead()
   or CSM_Buffer::Close() are defined as const methods.

2. CSM_RecipientIdentifier::AccessIssuerAndSerial() returns a
   const CSM_IssuerAndSerialNumber* pointer, but this has to
   be cast to a non-const pointer because its GetIssuer() and
   GetSerial() methods are not defined as const.

It would be nice if these classes' use of const was made self-consistent
in the next SFL release so I can remove the const_cast's.

-- 
John Stark
Tel: +44 1223 566732
Mobile: +44 7968 110628
E-mail: jas@xxxxxxxxxxxx
Web: http://www.metanate.com