/*
- * $Id: macbin.c,v 1.14 2009-10-14 01:38:28 didg Exp $
+ * $Id: macbin.c,v 1.15 2010-01-27 21:27:53 didg Exp $
*/
#ifdef HAVE_CONFIG_H
* return zero and no more than that.
*/
-int bin_read( int fork, char *buffer, int length)
+ssize_t bin_read( int fork, char *buffer, size_t length)
{
char *buf_ptr;
- int readlen;
- int cc = 1;
+ size_t readlen;
+ ssize_t cc = 1;
off_t pos;
#if DEBUG >= 3
fprintf( stderr, "bin_read: remaining length is %d\n", bin.forklen[fork] );
#endif /* DEBUG >= 3 */
- if (bin.forklen[fork] > length) {
- fprintf(stderr, "This should never happen, dude! length %d, fork length == %u\n", length, bin.forklen[fork]);
- return bin.forklen[fork];
+ if (bin.forklen[fork] > 0x7FFFFFFF) {
+ fprintf(stderr, "This should never happen, dude! fork length == %u\n", bin.forklen[fork]);
+ return -1;
}
if ( bin.forklen[ fork ] == 0 ) {
* bin_write
*/
-int bin_write(int fork, char *buffer, int length)
+ssize_t bin_write(int fork, char *buffer, size_t length)
{
char *buf_ptr;
- int writelen;
- int cc = 0;
+ size_t writelen;
+ ssize_t cc = 0;
off_t pos;
u_char padchar = 0x7f;
/* Not sure why, but it seems this must be 0x7f to match
return( cc );
}
- if (length > bin.forklen[fork]) {
- fprintf(stderr, "This should never happen, dude! length %d, fork length %u\n", length, bin.forklen[fork]);
- return bin.forklen[fork];
- }
-
bin.forklen[fork] -= length;
/*