Made some changes to the I/O stream library for memory streams.
There were a number of potential problems due to the possibility
of integer overflow.
Changed some integral types to the larger types size_t or ssize_t.
For example, the function mem_resize now takes the buffer size parameter
as a size_t.
Added a new function jas_stream_memopen2, which takes a
buffer size specified as a size_t instead of an int.
This can be used in jas_image_cmpt_create to avoid potential
overflow problems.

Added a new function jas_deprecated to warn about reliance on
deprecated library behavior.
int jas_stream_write(jas_stream_t *stream, const void *buf, int cnt)
{
 	int n;
 	const char *bufptr;
 
	if (cnt < 0) {
		jas_deprecated("negative count for jas_stream_write");
	}

 	bufptr = buf;
 
 	n = 0;
	while (n < cnt) {
		if (jas_stream_putc(stream, *bufptr) == EOF) {
			return n;
		}
		++bufptr;
		++n;
	}

	return n;
}

int jas_stream_write(jas_stream_t *stream, const void *buf, int cnt)
{
 	int n;
 	const char *bufptr;
 
 	bufptr = buf;
 
 	n = 0;
	while (n < cnt) {
		if (jas_stream_putc(stream, *bufptr) == EOF) {
			return n;
		}
		++bufptr;
		++n;
	}

	return n;
}
