+ const char *src = (const char *) &key;
+
+ key.len = 2;
+ key.mem[0] = i << 8;
+ key.mem[1] = i & 255;
+ iscz1_encode (codec_handle, &dst, &src);
+ if (dst > dst_buf + num*10)
+ {
+ printf ("%s: i=%d size overflow\n", prog, i);
+ return 1;
+ }
+ }
+ iscz1_stop(codec_handle);
+
+ codec_handle =iscz1_start();
+
+ if (1)
+ {
+ const char *src = dst_buf;
+ for (i = 0; i<num; i++)
+ {
+ char *dst = (char *) &key;
+ const char *src0 = src;
+ iscz1_decode(codec_handle, &dst, &src);
+
+ if (key.len != 2)
+ {
+ printf ("%s: i=%d key.len=%d expected 2\n", prog,
+ i, key.len);
+ while (src0 != src)
+ {
+ printf (" %02X (%d decimal)", *src0, *src0);
+ src0++;
+ }
+ printf ("\n");
+ return 2;
+ }
+ if (key.mem[0] != (i<<8))
+ {
+ printf ("%s: i=%d mem[0]=" ZINT_FORMAT " expected "
+ "%d\n", prog, i, key.mem[0], i>>8);
+ while (src0 != src)
+ {
+ printf (" %02X (%d decimal)", *src0, *src0);
+ src0++;
+ }
+ printf ("\n");
+ return 3;
+ }
+ if (key.mem[1] != (i&255))
+ {
+ printf ("%s: i=%d mem[0]=" ZINT_FORMAT " expected %d\n",
+ prog, i, key.mem[1], i&255);
+ while (src0 != src)
+ {
+ printf (" %02X (%d decimal)", *src0, *src0);
+ src0++;
+ }
+ printf ("\n");
+ return 4;
+ }
+ }
+ }