예제 #1
0
/**
 * read
 * reads data into a buffer
 * @return number of bytes read
 * @param buf buffer to read into
 * @param off offset to start reading from
 * @param len number of bytes to read
 */
boost::uint32_t hpiutil::sqshstream::read(boost::uint8_t *buf, const boost::uint32_t off, const boost::uint32_t len)
{
	position = bitmin(off,fullsize);
	if ((position >= fullsize)||!valid)
		return 0;
	boost::uint32_t reallen = bitmin(len,(fullsize-position));
	for (int i = 0; i < reallen; i++)
		buf[i] = data[position++];
	return position - off;
}
예제 #2
0
/**
 * read
 * reads data into a buffer
 * @return the number of bytes read
 * @param buf buffer to read into
 * @param off offset in substream to start reading from
 * @param len size of data to read
 */
boost::uint32_t hpiutil::substream::read(boost::uint8_t *buf, const boost::uint32_t off, const boost::uint32_t len)
{
	position = bitmin(off,length);
	if (position >= length)
		return 0;
	boost::uint32_t reallen = bitmin(len,(length-position));
	for (boost::uint32_t j = 0; j < reallen; j++)
		buf[j] = data[position++];
	return position-off;
}
예제 #3
0
/**
 * read
 * reads data into a buffer
 * @return number of bytes read
 * @param buf buffer to read into
 */
boost::uint32_t hpiutil::sqshstream::read(boost::uint8_t *buf)
{
	if ((position >= fullsize)||!valid)
		return 0;
	boost::uint32_t oldpos = position;
	boost::uint32_t len = bitmin(sizeof(buf),(fullsize-position));
	for (int i = 0; i < len; i++)
		buf[i] = data[position++];
	return position - oldpos;
}
예제 #4
0
/**
 * read
 * reads data into a buffer
 * @return the number of bytes read
 * @param buf buffer to read into
 */
boost::uint32_t hpiutil::substream::read(boost::uint8_t *buf)
{
	if (position >= length)
		return 0;
	boost::uint32_t oldpos = position;
	boost::uint32_t len = bitmin(sizeof(buf),(length-position));
	for (boost::uint32_t j = 0; j < len; j++)
		buf[j] = data[position++];
	return position - oldpos;
}