question

Upvotes
Accepted
34 8 14 19

RSSL_INIT_ENCODE_ITERATOR missing initializer

The RsslEncodeIterator structure is RTSDK 2.0.6


typedef struct RsslEncIterator

{

RsslBuffer *_pBuffer; /*!< Buffer to encode into, should be set with rsslSetEncodeIteratorBuffer(). RsslBuffer::length should indicate the number of bytes available.*/

char *_curBufPtr; /*!< The current encoding position in the associated buffer */

char *_endBufPtr; /*!< The end of the buffer for encoding, used to ensure that encoding functions do not go past end of buffer */

RsslUInt8 _majorVersion; /*!< RWF Major Version this iterator will encode, should be set with rsslSetEncodeIteratorRWFVersion() */

RsslUInt8 _minorVersion; /*!< RWF Minor Version this iterator will encode, should be set with rsslSetEncodeIteratorRWFVersion() */

RsslInt8 _encodingLevel; /*!< Current nesting level */

RsslEncodingLevel _levelInfo[RSSL_ITER_MAX_LEVELS]; /*!< Information needed for encoding across all levels */

RsslElementSetDefDb *_pGlobalElemListSetDb; /*!< Pointer to a global set definition for element lists.*/

RsslFieldSetDefDb *_pGlobalFieldListSetDb; /*!< Pointer to a global set definition for field lists.*/

} RsslEncodeIterator;



However the RSSL_INIT_ENCODE_ITERATOR is missing initializer for _pGlobalElemListSetDb and _pGlobalElemListSetDb . Is that an error or purposley left out? Compiler is giving warning for missing initialieers.



#define RSSL_INIT_ENCODE_ITERATOR { 0, 0, 0, RSSL_RWF_MAJOR_VERSION, RSSL_RWF_MINOR_VERSION, -1, { \

RSSL_INIT_ENCODING_LEVEL, \

RSSL_INIT_ENCODING_LEVEL, \

RSSL_INIT_ENCODING_LEVEL, \

RSSL_INIT_ENCODING_LEVEL, \

RSSL_INIT_ENCODING_LEVEL, \

RSSL_INIT_ENCODING_LEVEL, \

RSSL_INIT_ENCODING_LEVEL, \

RSSL_INIT_ENCODING_LEVEL, \

RSSL_INIT_ENCODING_LEVEL, \

RSSL_INIT_ENCODING_LEVEL, \

RSSL_INIT_ENCODING_LEVEL, \

RSSL_INIT_ENCODING_LEVEL, \

RSSL_INIT_ENCODING_LEVEL, \

RSSL_INIT_ENCODING_LEVEL, \

RSSL_INIT_ENCODING_LEVEL, \

RSSL_INIT_ENCODING_LEVEL \

}}

#technologytrepcencoding
icon clock
10 |1500

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Upvotes
Accepted
15.5k 32 5 10

Hi @vishal.anand

Please be informed that it's mentioned in the issue (#205) on GitHub that this is fixed in the Real-Time-SDK-2.0.8.L1.

icon clock
10 |1500

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

thanks for the fix.
Upvotes
86.2k 292 53 79

@vishal.anand

Thank you for reporting this issue.

Yes, you are correct. I have submitted this issue (#205) on GitHub.


icon clock
10 |1500

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Thanks. These are pointer variables? Should I for now explicitly set them to NULL? Can it be dangerous to go without initializing them?
Upvotes
86.2k 292 53 79

@vishal.anand

You can call the rsslClearEncodeIterator method instead.

RTR_C_ALWAYS_INLINE void rsslClearEncodeIterator( RsslEncodeIterator *pIter)
{
    pIter->_encodingLevel = -1;
    pIter->_pBuffer = 0;
    pIter->_majorVersion = RSSL_RWF_MAJOR_VERSION;  //This should be initialized to the MAJOR version of RWF being encoded
    pIter->_minorVersion = RSSL_RWF_MINOR_VERSION;  // This should be initialized to the MINOR version of RWF being encoded
    pIter->_pGlobalFieldListSetDb = NULL;
    pIter->_pGlobalElemListSetDb = NULL;
}

Otherwise, you can define a new macro to set _pGlobalElemListSetDb and _pGlobalFieldListSetDb variables to 0 (NULL).

#define RSSL_INIT_ENCODE_ITERATOR_NEW  { 0, 0, 0, RSSL_RWF_MAJOR_VERSION, RSSL_RWF_MINOR_VERSION, -1, { \
    RSSL_INIT_ENCODING_LEVEL, \
    RSSL_INIT_ENCODING_LEVEL, \
    RSSL_INIT_ENCODING_LEVEL, \
    RSSL_INIT_ENCODING_LEVEL, \
    RSSL_INIT_ENCODING_LEVEL, \
    RSSL_INIT_ENCODING_LEVEL, \
    RSSL_INIT_ENCODING_LEVEL, \
    RSSL_INIT_ENCODING_LEVEL, \
    RSSL_INIT_ENCODING_LEVEL, \
    RSSL_INIT_ENCODING_LEVEL, \
    RSSL_INIT_ENCODING_LEVEL, \
    RSSL_INIT_ENCODING_LEVEL, \
    RSSL_INIT_ENCODING_LEVEL, \
    RSSL_INIT_ENCODING_LEVEL, \
    RSSL_INIT_ENCODING_LEVEL, \
    RSSL_INIT_ENCODING_LEVEL \
}, 0,0}
icon clock
10 |1500

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Thanks for the answer. I am doing that now and it compiles with warnings.

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.