]> arthur.barton.de Git - netatalk.git/blobdiff - bin/megatron/hqx.c
Use correct member of forklen array, from Olaf Hering
[netatalk.git] / bin / megatron / hqx.c
index acdd519e43e5bfa6aef2f1e398173ffa95fc2044..3f0406d55ade78b48eb394a5e24dff28b45e8787 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * $Id: hqx.c,v 1.11 2002-02-19 16:32:17 srittau Exp $
+ * $Id: hqx.c,v 1.14 2005-04-28 20:49:19 bfernhomberg Exp $
  */
 
 #ifdef HAVE_CONFIG_H
@@ -28,6 +28,7 @@
 #include <netatalk/endian.h>
 
 #include "megatron.h"
+#include "nad.h"
 #include "hqx.h"
 
 #define HEXOUTPUT      0
@@ -110,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
@@ -205,9 +207,9 @@ int hqx_read( fork, buffer, length )
     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 ) {
@@ -391,7 +393,7 @@ int hqx_header_read( fh )
  */
 
 int hqx_header_write( fh )
-    struct FHeader     *fh;
+    struct FHeader     *fh _U_;
 {
     return( -1 );
 }