char *CJHTreeNode::expandKeys(void *src,unsigned keylength,size32_t &retsize, bool rowcompression) { Owned<IExpander> exp = rowcompression?createRDiffExpander():createLZWExpander(true); int len=exp->init(src); if (len==0) { retsize = 0; return NULL; } char *outkeys=(char *) allocMem(len); exp->expand(outkeys); retsize = len; return outkeys; }
size32_t ThorExpand(const void * src, size32_t srcSz, void * dest, size32_t destSz) { size32_t ret; memcpy(&ret, src, sizeof(size32_t)); byte *data = (byte *)src+sizeof(size32_t); if(ret) // compressed { Owned<IExpander> expander = createLZWExpander(); assertex(destSz >= ret); expander->init(data); expander->expand(dest); } else { ret = srcSz - sizeof(size32_t); assertex(destSz >= ret); memcpy(dest, data, ret); } return ret; }