Logo Search packages:      
Sourcecode: icu version File versions  Download package

U_STABLE void U_EXPORT2 udata_getInfo ( UDataMemory pData,
UDataInfo pInfo 
)

Get the information from the data memory header. This allows to get access to the header containing platform data properties etc. which is not part of the data itself and can therefore not be accessed via the pointer that udata_getMemory() returns.

Parameters:
pData pointer to the data memory object
pInfo pointer to a UDataInfo object; its size field must be set correctly, typically to sizeof(UDataInfo).
*pInfo will be filled with the UDataInfo structure in the data memory object. If this structure is smaller than pInfo->size, then the size will be adjusted and only part of the structure will be filled. ICU 2.0

Definition at line 1511 of file udata.c.

References UDataInfo::isBigEndian, NULL, UDataInfo::reservedWord, UDataInfo::size, and U_IS_BIG_ENDIAN.

                                                    {
    if(pInfo!=NULL) {
        if(pData!=NULL && pData->pHeader!=NULL) {
            const UDataInfo *info=&pData->pHeader->info;
            uint16_t dataInfoSize=udata_getInfoSize(info);
            if(pInfo->size>dataInfoSize) {
                pInfo->size=dataInfoSize;
            }
            uprv_memcpy((uint16_t *)pInfo+1, (const uint16_t *)info+1, pInfo->size-2);
            if(info->isBigEndian!=U_IS_BIG_ENDIAN) {
                /* opposite endianness */
                uint16_t x=info->reservedWord;
                pInfo->reservedWord=(uint16_t)((x<<8)|(x>>8));
            }
        } else {
            pInfo->size=0;
        }
    }
}


Generated by  Doxygen 1.6.0   Back to index