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

U_CAPI int32_t U_EXPORT2 uspoof_serialize ( USpoofChecker sc,
void *  data,
int32_t  capacity,
UErrorCode status 
)

Serialize the data for a spoof detector into a chunk of memory. The flattened spoof detection tables can later be used to efficiently instantiate a new Spoof Detector.

Parameters:
sc the Spoof Detector whose data is to be serialized.
data a pointer to 32-bit-aligned memory to be filled with the data, can be NULL if capacity==0
capacity the number of bytes available at data, or 0 for preflighting
status an in/out ICU UErrorCode; possible errors include:
  • U_BUFFER_OVERFLOW_ERROR if the data storage block is too small for serialization
  • U_ILLEGAL_ARGUMENT_ERROR the data or capacity parameters are bad
Returns:
the number of bytes written or needed for the spoof data
See also:
utrie2_openFromSerialized() ICU 4.2

Definition at line 812 of file uspoof.cpp.

References SpoofImpl::fSpoofData, NULL, U_BUFFER_OVERFLOW_ERROR, and U_FAILURE.

                                                                                    {
    SpoofImpl *This = SpoofImpl::validateThis(sc, *status);
    if (This == NULL) {
        U_ASSERT(U_FAILURE(*status));
        return 0;
    }
    int32_t dataSize = This->fSpoofData->fRawData->fLength;
    if (capacity < dataSize) {
        *status = U_BUFFER_OVERFLOW_ERROR;
        return dataSize;
    }
    uprv_memcpy(buf, This->fSpoofData->fRawData, dataSize);
    return dataSize;
}


Generated by  Doxygen 1.6.0   Back to index