/*
- * $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
* entry_buf is used for reading in entry descriptors, and for reading in
* the actual entries of FILEINFO, FINDERINFO, and DATES.
*/
- u_char entry_buf[ 16 ];
+ u_char entry_buf[ADEDLEN_FINDERI];
u_int32_t entry_id;
u_int32_t time_seconds;
u_short mask = 0xfcee;
return( -1 );
}
}
- if (( single.entry[ ADEID_FINDERI ].ade_len < 16 ) ||
+ if (( single.entry[ ADEID_FINDERI ].ade_len < ADEDLEN_FINDERI ) ||
( single.entry[ ADEID_FINDERI ].ade_off <= AD_HEADER_LEN )) {
fprintf( stderr, "%s has bogus FinderInfo.\n", single.path );
return( -1 );
} else {
pos = lseek( single.filed,
single.entry[ ADEID_FINDERI ].ade_off, SEEK_SET );
- if ( read( single.filed, (char *)entry_buf, sizeof( entry_buf )) !=
- sizeof( entry_buf )) {
+ if ( read( single.filed, (char *)entry_buf, ADEDLEN_FINDERI) != ADEDLEN_FINDERI) {
perror( "Premature end of file :" );
return( -1 );
}
*
*/
-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 ) {