[Http-crcsync] crccache ready for some testing I think

Rusty Russell rusty at rustcorp.com.au
Tue Mar 31 01:07:23 EDT 2009


On Tuesday 31 March 2009 14:55:05 Rusty Russell wrote:
> For that, you need this as well:

(At this point, note that this is all available via
 bzr clone http://ccan.ozlabs.org/repo )

And to fix the actual output (I turned your test.c into a ccan testcase
and manually calculated what it should show), you need this patch.

BTW, what licence for test.c?

=== modified file 'ccan/crcsync/crcsync.c'
--- ccan/crcsync/crcsync.c	2009-03-31 04:05:04 +0000
+++ ccan/crcsync/crcsync.c	2009-03-31 05:01:46 +0000
@@ -206,7 +210,9 @@
 			ctx->buffer_end -= ctx->buffer_start;
 			ctx->buffer_start = 0;
 		}
-		memcpy(ctx->buffer + ctx->buffer_end, buf, len);
+
+		/* Copy len bytes from tail of buffer. */
+		memcpy(ctx->buffer + ctx->buffer_end, buf + buflen - len, len);
 		ctx->buffer_end += len;
 		assert(buffer_size(ctx) <= ctx->block_size);
 	}



More information about the Http-crcsync mailing list