]> arthur.barton.de Git - netatalk.git/blobdiff - bin/megatron/hqx.c
Remove a lot of warning, from cvs HEAD
[netatalk.git] / bin / megatron / hqx.c
index 0a4e60ab1c875dbf92587dc0dca959fb4b76a8cc..7510a13c9f81a640183cecd0fd4bce0dc5a033e0 100644 (file)
@@ -1,34 +1,34 @@
 /*
- * $Id: hqx.c,v 1.8 2001-06-29 14:14:46 rufustfirefly Exp $
+ * $Id: hqx.c,v 1.12.4.1.4.2 2005-09-27 10:40:40 didg Exp $
  */
 
 #ifdef HAVE_CONFIG_H
 #include "config.h"
 #endif /* HAVE_CONFIG_H */
 
-#include <stdlib.h>
 #include <sys/types.h>
 #include <sys/uio.h>
 #include <sys/time.h>
 #include <sys/param.h>
-#ifdef notdef
-#if BSD >= 199006
-# include <machine/endian.h>
-#else /* BSD >= 199006 */
-# include <netinet/in.h>
-#endif /* BSD >= 199006 */
-#endif /* notdef */
+
+#include <string.h>
+#include <ctype.h>
+#include <stdio.h>
+#include <stdlib.h>
 #include <time.h>
+
+#include <unistd.h>
 #ifdef HAVE_FCNTL_H
 #include <fcntl.h>
 #endif /* HAVE_FCNTL_H */
-#include <string.h>
-#include <syslog.h>
-#include <ctype.h>
-#include <stdio.h>
+
+#include <netinet/in.h>
+
 #include <atalk/adouble.h>
 #include <netatalk/endian.h>
+
 #include "megatron.h"
+#include "nad.h"
 #include "hqx.h"
 
 #define HEXOUTPUT      0
@@ -111,6 +111,7 @@ int hqx_open( hqxfile, flags, fh, options )
 #if DEBUG
     fprintf( stderr, "megatron: entering hqx_open\n" );
 #endif /* DEBUG */
+    select_charset( options);
     if ( flags == O_RDONLY ) {
 
 #if HEXOUTPUT
@@ -132,7 +133,7 @@ int hqx_open( hqxfile, flags, fh, options )
 #if DEBUG
                off_t   pos;
 
-               pos = lseek( hqx.filed, 0, L_INCR );
+               pos = lseek( hqx.filed, 0, SEEK_CUR );
                fprintf( stderr, "megatron: current position is %ld\n", pos );
 #endif /* DEBUG */
                return( 0 );
@@ -199,16 +200,16 @@ int hqx_read( fork, buffer, length )
 #if DEBUG >= 3
     {
        off_t   pos;
-       pos = lseek( hqx.filed, 0, L_INCR );
+       pos = lseek( hqx.filed, 0, SEEK_CUR );
        fprintf( stderr, "hqx_read: current position is %ld\n", pos );
     }
     fprintf( stderr, "hqx_read: fork is %s\n", forkname[ fork ] );
     fprintf( stderr, "hqx_read: remaining length is %d\n", hqx.forklen[fork] );
 #endif /* DEBUG >= 3 */
 
-    if ( hqx.forklen[ fork ] < 0 ) {
-       fprintf( stderr, "This should never happen, dude!\n" );
-       return( hqx.forklen[ fork ] );
+    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 ] == 0 ) {
@@ -392,7 +393,7 @@ int hqx_header_read( fh )
  */
 
 int hqx_header_write( fh )
-    struct FHeader     *fh;
+    struct FHeader     *fh _U_;
 {
     return( -1 );
 }