#include "cio.h"
#include <setjmp.h>
+#include <memory.h>
static unsigned char *cio_start; /* pointer to the start of the stream */
static unsigned char *cio_end; /* pointer to the end of the stream */
{
cio_bp += n;
}
+
+/*
+ * Read n bytes, copy to buffer
+ *
+ * n : number of bytes to transfer
+ */
+void cio_read_to_buf(unsigned char* dest_buf, int n)/* Glenn adds */
+{
+ if (cio_bp + n > cio_end)
+ longjmp(j2k_error, 1);
+ memcpy(cio_bp, dest_buf, n);
+ cio_bp += n;
+}
+
+/*
+ * Write n bytes, copy from buffer
+ *
+ * n : number of bytes to transfer
+ */
+void cio_write_from_buf(unsigned char* src_buf, int n)/* Glenn adds */
+{
+ if (cio_bp + n > cio_end)
+ longjmp(j2k_error, 1);
+ memcpy(src_buf, cio_bp, n);
+ cio_bp += n;
+}
\ No newline at end of file