private static int doDecompress(IntPtr dbp, IntPtr prevKeyp, IntPtr prevDatap, IntPtr cmpp, IntPtr destKeyp, IntPtr destDatap) { DB db = new DB(dbp, false); DatabaseEntry prevKey = DatabaseEntry.fromDBT(new DBT(prevKeyp, false)); DatabaseEntry prevData = DatabaseEntry.fromDBT(new DBT(prevDatap, false)); DBT compressed = new DBT(cmpp, false); DBT destKey = new DBT(destKeyp, false); DBT destData = new DBT(destDatap, false); BTreeDatabase btdb = (BTreeDatabase)(db.api_internal); uint size; try { KeyValuePair <DatabaseEntry, DatabaseEntry> kvp = btdb.Decompress(prevKey, prevData, compressed.data, out size); int keylen = kvp.Key.Data.Length; int datalen = kvp.Value.Data.Length; destKey.size = (uint)keylen; destData.size = (uint)datalen; if (keylen > destKey.ulen || datalen > destData.ulen) { return(DbConstants.DB_BUFFER_SMALL); } Marshal.Copy(kvp.Key.Data, 0, destKey.dataPtr, keylen); Marshal.Copy(kvp.Value.Data, 0, destData.dataPtr, datalen); compressed.size = size; return(0); } catch (Exception) { return(-1); } }