MCPcopy Create free account
hub / github.com/F-Stack/f-stack / Pred1Decompress

Function Pred1Decompress

freebsd/netgraph/ng_pred1.c:618–651  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

616 */
617
618static int
619Pred1Decompress(node_p node, u_char *source, u_char *dest, int slen, int dlen)
620{
621 const priv_p priv = NG_NODE_PRIVATE(node);
622 int i;
623 u_char flags, *orgdest;
624
625 orgdest = dest;
626 while (slen) {
627 flags = *source++;
628 slen--;
629 for (i = 0; i < 8; i++, flags >>= 1) {
630 if (dlen <= 0)
631 return(-1);
632 if (flags & 0x01)
633 /* Guess correct */
634 *dest = priv->GuessTable[priv->Hash];
635 else {
636 if (!slen)
637 /* We seem to be really done -- cabo. */
638 break;
639
640 /* Guess wrong. */
641 priv->GuessTable[priv->Hash] = *source;
642 /* Read from source. */
643 *dest = *source++;
644 slen--;
645 }
646 HASH(*dest++);
647 dlen--;
648 }
649 }
650 return (dest - orgdest);
651}
652
653/*
654 * Pred1SyncTable()

Callers 1

ng_pred1_decompressFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected