/*
- * $Id: asingle.c,v 1.13 2009-10-14 01:38:28 didg Exp $
+ * $Id: asingle.c,v 1.14 2010-01-27 21:27:53 didg Exp $
*/
#ifdef HAVE_CONFIG_H
*
*/
-int single_read( int fork, char *buffer, u_int32_t length)
+ssize_t single_read( int fork, char *buffer, size_t length)
{
u_int32_t entry_id;
char *buf_ptr;
- int readlen;
- int cc = 1;
+ size_t readlen;
+ ssize_t cc = 1;
off_t pos;
switch ( fork ) {
break;
}
- if (single.entry[entry_id].ade_len > length) {
- fprintf(stderr, "single_read: Trying to read past end of fork!, length %d, ade_len == %u\n", length, single.entry[entry_id].ade_len);
- return single.entry[entry_id].ade_len;
+ if (single.entry[entry_id].ade_len > 0x7FFFFFFF) {
+ fprintf(stderr, "single_read: Trying to read past end of fork!, ade_len == %u\n", single.entry[entry_id].ade_len);
+ return -1;
}
if ( single.entry[ entry_id ].ade_len == 0 ) {
if ( fork == DATA ) {
/*
- * $Id: asingle.h,v 1.3 2005-04-28 20:49:19 bfernhomberg Exp $
+ * $Id: asingle.h,v 1.4 2010-01-27 21:27:53 didg Exp $
*/
#ifndef _ASINGLE_H
int single_close(int readflag);
int single_header_read(struct FHeader *fh, int version);
int single_header_test(void);
-int single_read(int fork, char *buffer, u_int32_t length);
+ssize_t single_read(int fork, char *buffer, size_t length);
#endif /* _ASINGLE_H */
/*
- * $Id: hqx.c,v 1.17 2009-10-14 02:24:04 didg Exp $
+ * $Id: hqx.c,v 1.18 2010-01-27 21:27:53 didg Exp $
*/
#ifdef HAVE_CONFIG_H
#define BHH_CRCSIZ 2
#define BHH_HEADSIZ 21
-/* Forward declarations.
- */
-int skip_junk(int line);
-int hqx_close(int keepflag);
-int hqx_header_read(struct FHeader *fh);
-int hqx_header_write(struct FHeader *fh);
-int hqx_7tobin(char *outbuf, int datalen);
-int hqx7_fill(u_char *hqx7_ptr);
-
#if HEXOUTPUT
FILE *rawhex, *expandhex;
#endif /* HEXOUTPUT */
* return zero and no more than that.
*/
-int hqx_read(int fork, char *buffer, int length)
+ssize_t hqx_read(int fork, char *buffer, size_t length)
{
u_short storedcrc;
- int readlen;
- int cc;
+ size_t readlen;
+ size_t cc;
#if DEBUG >= 3
{
fprintf( stderr, "hqx_read: remaining length is %d\n", hqx.forklen[fork] );
#endif /* DEBUG >= 3 */
- if (hqx.forklen[fork] > length) {
- fprintf(stderr, "This should never happen, dude! length %d, fork length == %u\n", length, hqx.forklen[fork]);
- return hqx.forklen[fork];
+ if (hqx.forklen[fork] > 0x7FFFFFFF) {
+ fprintf(stderr, "This should never happen, dude!, fork length == %u\n", hqx.forklen[fork]);
+ return -1;
}
if ( hqx.forklen[ fork ] == 0 ) {
* it sets the pointers to the hqx7 buffer up to point to the valid data.
*/
-int hqx7_fill(u_char *hqx7_ptr)
+ssize_t hqx7_fill(u_char *hqx7_ptr)
{
- int cc;
- int cs;
+ ssize_t cc;
+ size_t cs;
cs = hqx7_ptr - hqx7_buf;
if ( cs >= sizeof( hqx7_buf )) return( -1 );
* file is reached.
*/
-int hqx_7tobin( char *outbuf, int datalen)
+size_t hqx_7tobin( char *outbuf, size_t datalen)
{
static u_char hqx8[3];
static int hqx8i;
/*
- * $Id: hqx.h,v 1.2 2001-06-29 14:14:46 rufustfirefly Exp $
+ * $Id: hqx.h,v 1.3 2010-01-27 21:27:53 didg Exp $
*/
#ifndef _HQX_H
int skip_junk(int line);
int hqx_open(char *hqxfile, int flags, struct FHeader *fh, int options);
int hqx_close(int keepflag);
-int hqx_read(int fork, char *buffer, int length);
+ssize_t hqx_read(int fork, char *buffer, size_t length);
int hqx_header_read(struct FHeader *fh);
int hqx_header_write(struct FHeader *fh);
-int hqx_7tobin(char *outbuf, int datalen);
-int hqx7_fill(u_char *hqx7_ptr);
+size_t hqx_7tobin(char *outbuf, size_t datalen);
+ssize_t hqx7_fill(u_char *hqx7_ptr);
#endif /* _HQX_H */
/*
- * $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;
/*
/*
- * $Id: macbin.h,v 1.3 2009-10-13 22:55:36 didg Exp $
+ * $Id: macbin.h,v 1.4 2010-01-27 21:27:53 didg Exp $
*/
#ifndef _MACBIN_H
int bin_open(char *binfile, int flags, struct FHeader *fh, int options);
int bin_close(int keepflag);
-int bin_read(int fork, char *buffer, int length);
-int bin_write(int fork, char *buffer, int length);
+ssize_t bin_read(int fork, char *buffer, size_t length);
+ssize_t bin_write(int fork, char *buffer, size_t length);
int bin_header_read(struct FHeader *fh, int revision);
int bin_header_write(struct FHeader *fh);
int test_header(void);
/*
- * $Id: megatron.c,v 1.13 2009-10-14 02:24:04 didg Exp $
+ * $Id: megatron.c,v 1.14 2010-01-27 21:27:53 didg Exp $
*/
#ifdef HAVE_CONFIG_H
}
}
-static int from_read(int un, int fork, char *buf, int len)
+static ssize_t from_read(int un, int fork, char *buf, size_t len)
{
switch ( un ) {
case MEGATRON :
}
}
-static int to_write(int to, int fork, int bufc)
+static ssize_t to_write(int to, int fork, size_t bufc)
{
switch ( to ) {
case MEGATRON :
{
struct stat st;
struct FHeader fh;
- int bufc;
+ ssize_t bufc;
int fork;
- unsigned int forkred;
+ size_t forkred;
/*
* If the source file is not stdin, make sure it exists and
/*
- * $Id: nad.c,v 1.17 2009-10-14 01:38:28 didg Exp $
+ * $Id: nad.c,v 1.18 2010-01-27 21:27:53 didg Exp $
*/
#ifdef HAVE_CONFIG_H
static int forkeid[] = { ADEID_DFORK, ADEID_RFORK };
-int nad_read(int fork, char *forkbuf, int bufc)
+ssize_t nad_read(int fork, char *forkbuf, size_t bufc)
{
- int cc = 0;
+ ssize_t cc = 0;
#if DEBUG
fprintf( stderr, "Entering nad_read\n" );
return( cc );
}
-int nad_write(int fork, char *forkbuf, int bufc)
+ssize_t nad_write(int fork, char *forkbuf, size_t bufc)
{
char *buf_ptr;
- int writelen;
- int cc = 0;
+ size_t writelen;
+ ssize_t cc = 0;
#if DEBUG
fprintf( stderr, "Entering nad_write\n" );
/*
- * $Id: nad.h,v 1.4 2005-04-28 20:49:20 bfernhomberg Exp $
+ * $Id: nad.h,v 1.5 2010-01-27 21:27:53 didg Exp $
*/
#ifndef _NAD_H
int nad_open(char *path, int openflags, struct FHeader *fh, int options);
int nad_header_read(struct FHeader *fh);
int nad_header_write(struct FHeader *fh);
-int nad_read(int fork, char *forkbuf, int bufc);
-int nad_write(int fork, char *forkbuf, int bufc);
+ssize_t nad_read(int fork, char *forkbuf, size_t bufc);
+ssize_t nad_write(int fork, char *forkbuf, size_t bufc);
int nad_close(int status);
void select_charset(int options);