ssize_t rsize;
int rsize;
__get_page(HTAB *hashp,	char * p,	uint32 bucket, 	int is_bucket, 	int is_disk, 	int is_bitmap){	register int fd, page;	size_t size;	ssize_t rsize;	uint16 *bp;	fd = hashp->fp;	size = hashp->BSIZE;	if ((fd == -1) || !is_disk) {		PAGE_INIT(p);		return (0);	}	if (is_bucket)		page = BUCKET_TO_PAGE(bucket);	else		page = OADDR_TO_PAGE(bucket);	if ((MY_LSEEK(fd, (off_t)page << hashp->BSHIFT, SEEK_SET) == -1) ||	    ((rsize = read(fd, p, size)) == -1))		return (-1);	bp = (uint16 *)p;	if (!rsize)		bp[0] = 0;	/* We hit the EOF, so initialize a new page */	else		if (rsize != size) {			errno = EFTYPE;			return (-1);		}	if (!is_bitmap && !bp[0]) {		PAGE_INIT(p);	} else {#ifdef DEBUG		if(BYTE_ORDER == LITTLE_ENDIAN)		  {			int is_little_endian;			is_little_endian = BYTE_ORDER;		  }		else if(BYTE_ORDER == BIG_ENDIAN)		  {			int is_big_endian;			is_big_endian = BYTE_ORDER;		  }		else		  {			assert(0);		  }#endif		if (hashp->LORDER != BYTE_ORDER) {			register int i, max;			if (is_bitmap) {				max = hashp->BSIZE >> 2; /* divide by 4 */				for (i = 0; i < max; i++)					M_32_SWAP(((int *)p)[i]);			} else {				M_16_SWAP(bp[0]);				max = bp[0] + 2;	    		/* bound the size of max by	     		 * the maximum number of entries	     		 * in the array	     		 */				if(max > (size / sizeof(uint16)))					return(DATABASE_CORRUPTED_ERROR);				/* do the byte order swap				 */				for (i = 1; i <= max; i++)					M_16_SWAP(bp[i]);			}		}		/* check the validity of the page here		 * (after doing byte order swaping if necessary)		 */		if(!is_bitmap && bp[0] != 0)		  {			uint16 num_keys = bp[0];			uint16 offset;			uint16 i;			/* bp[0] is supposed to be the number of			 * entries currently in the page.  If			 * bp[0] is too large (larger than the whole			 * page) then the page is corrupted			 */			if(bp[0] > (size / sizeof(uint16)))				return(DATABASE_CORRUPTED_ERROR);						/* bound free space */			if(FREESPACE(bp) > size)				return(DATABASE_CORRUPTED_ERROR);					/* check each key and data offset to make 			 * sure they are all within bounds they 			 * should all be less than the previous 			 * offset as well. 			 */			offset = size;			for(i=1 ; i <= num_keys; i+=2)  			  {				/* ignore overflow pages etc. */				if(bp[i+1] >= REAL_KEY)	  			  {											if(bp[i] > offset || bp[i+1] > bp[i])									return(DATABASE_CORRUPTED_ERROR);								offset = bp[i+1];	  			  }				else	  			  {					/* there are no other valid keys after		 			 * seeing a non REAL_KEY		 			 */					break;	  			  }  			  }		}	}	return (0);}