/* * Get blob size information. */ static void GetBlobSize(ILSizeInfo *info, ILProgramItem *item, ILUInt32 offset) { ILUInt32 len; unsigned char lenbuf[IL_META_COMPRESS_MAX_SIZE]; if(ILImageGetBlob(ILProgramItem_Image(item), offset, &len)) { info->meta += len; info->meta += (unsigned long)(long)ILMetaCompressData(lenbuf, len); } }
void ILSerializeWriterSetString(ILSerializeWriter *writer, const char *str, int len) { if(str) { unsigned char header[IL_META_COMPRESS_MAX_SIZE]; int headerLen = ILMetaCompressData(header, len); unsigned char *buf = GetSpace(writer, headerLen + len); if(buf) { ILMemCpy(buf, header, headerLen); ILMemCpy(buf + headerLen, str, len); } } else { /* Encode the null string in the output */ unsigned char *buf = GetSpace(writer, 1); *buf = (unsigned char)0xFF; } }