42d3218
Patch by Guillem Jover <guillem@debian.org> for arj <= 3.10.22 which
42d3218
makes the code 64 bit clean. For further information, please see also
42d3218
http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=339815
42d3218
42d3218
Index: b/arj_arcv.c
42d3218
===================================================================
42d3218
--- a/arj_arcv.c	2005-06-21 22:53:12.000000000 +0300
42d3218
+++ b/arj_arcv.c	2008-06-16 08:25:43.000000000 +0300
42d3218
@@ -59,27 +59,27 @@ static char idxid_fault[]="?";
42d3218
 #define setup_hput(ptr) (tmp_hptr=(ptr))
42d3218
 
42d3218
 #define hget_byte() (*(tmp_hptr++)&0xFF)
42d3218
-#define hput_byte(c) (*(tmp_hptr++)=(char) (c))
42d3218
+#define hput_byte(c) (*(tmp_hptr++)=(uint8_t) (c))
42d3218
 
42d3218
 /* Reads two bytes from the header, incrementing the pointer */
42d3218
 
42d3218
-static unsigned int hget_word()
42d3218
+static uint16_t hget_word()
42d3218
 {
42d3218
- unsigned int result;
42d3218
+ uint16_t result;
42d3218
 
42d3218
  result=mget_word(tmp_hptr);
42d3218
- tmp_hptr+=sizeof(short);
42d3218
+ tmp_hptr+=sizeof(uint16_t);
42d3218
  return result;
42d3218
 }
42d3218
 
42d3218
 /* Reads four bytes from the header, incrementing the pointer */
42d3218
 
42d3218
-static unsigned long hget_longword()
42d3218
+static uint32_t hget_longword()
42d3218
 {
42d3218
- unsigned long result;
42d3218
+ uint32_t result;
42d3218
 
42d3218
  result=mget_dword(tmp_hptr);
42d3218
- tmp_hptr+=sizeof(unsigned long);
42d3218
+ tmp_hptr+=sizeof(uint32_t);
42d3218
  return result;
42d3218
 }
42d3218
 
42d3218
@@ -87,18 +87,18 @@ static unsigned long hget_longword()
42d3218
 
42d3218
 /* Writes two bytes to the header, incrementing the pointer */
42d3218
 
42d3218
-static void hput_word(unsigned int w)
42d3218
+static void hput_word(uint16_t w)
42d3218
 {
42d3218
  mput_word(w,tmp_hptr); 
42d3218
- tmp_hptr+=sizeof(unsigned short);
42d3218
+ tmp_hptr+=sizeof(uint16_t);
42d3218
 }
42d3218
 
42d3218
 /* Writes four bytes to the header, incrementing the pointer */
42d3218
 
42d3218
-static void hput_longword(unsigned long l)
42d3218
+static void hput_longword(uint32_t l)
42d3218
 {
42d3218
  mput_dword(l,tmp_hptr);
42d3218
- tmp_hptr+=sizeof(unsigned long);
42d3218
+ tmp_hptr+=sizeof(uint32_t);
42d3218
 }
42d3218
 
42d3218
 /* Calculates and stores the basic header size */
42d3218
Index: b/arj_proc.c
42d3218
===================================================================
42d3218
--- a/arj_proc.c	2008-06-16 08:25:28.000000000 +0300
42d3218
+++ b/arj_proc.c	2008-06-16 08:25:43.000000000 +0300
42d3218
@@ -585,7 +585,7 @@ int search_for_extension(char *name, cha
42d3218
 /* Returns the exact amount of data that could be safely written to the
42d3218
    destination volume */
42d3218
 
42d3218
-unsigned long get_volfree(unsigned int increment)
42d3218
+unsigned long get_volfree(unsigned long increment)
42d3218
 {
42d3218
  unsigned long pvol;
42d3218
  unsigned int arjsec_overhead;
42d3218
@@ -605,7 +605,7 @@ unsigned long get_volfree(unsigned int i
42d3218
  remain=volume_limit-ftell(aostream)-pvol-(long)arjsec_overhead-
42d3218
         (long)out_bytes-(long)cpos-(long)ext_voldata-
42d3218
         MULTIVOLUME_RESERVE-t_volume_offset;
42d3218
- return((unsigned long)min(remain, (unsigned long)increment));
42d3218
+ return((unsigned long)min(remain, increment));
42d3218
 }
42d3218
 
42d3218
 /* Performs various checks when multivolume data is packed to predict an
42d3218
@@ -2466,14 +2466,14 @@ static int get_str_from_jq()
42d3218
     *tsptr='\0';
42d3218
   endptr=tsptr;
42d3218
   tsptr=sptr;
42d3218
-  while((unsigned int)tsptr<(unsigned int)endptr&&patterns
42d3218
+  while((intptr_t)tsptr<(intptr_t)endptr&&patterns
42d3218
   {
42d3218
    while(*tsptr=='\0')
42d3218
     tsptr++;
42d3218
-   if((unsigned int)tsptr<(unsigned int)endptr)
42d3218
+   if((intptr_t)tsptr<(intptr_t)endptr)
42d3218
    {
42d3218
     search_str[patterns++]=tsptr;
42d3218
-    while(*tsptr!='\0'&&(unsigned int)tsptr<(unsigned int)endptr)
42d3218
+    while(*tsptr!='\0'&&(intptr_t)tsptr<(intptr_t)endptr)
42d3218
      tsptr++;
42d3218
    }
42d3218
   }
42d3218
@@ -2901,9 +2901,9 @@ char *ltrim(char *str)
42d3218
 #if (defined(WORDS_BIGENDIAN) || defined(ALIGN_POINTERS)) && !defined(ARJDISP) && !defined(REGISTER)
42d3218
 /* Model-independent routine to get 2 bytes from far RAM */
42d3218
 
42d3218
-unsigned int mget_word(char FAR *p)
42d3218
+uint16_t mget_word(char FAR *p)
42d3218
 {
42d3218
- unsigned int b0, b1;
42d3218
+ uint16_t b0, b1;
42d3218
 
42d3218
  b0=mget_byte(p);
42d3218
  b1=mget_byte(p+1);
42d3218
@@ -2912,9 +2912,9 @@ unsigned int mget_word(char FAR *p)
42d3218
 
42d3218
 /* Model-independent routine to get 4 bytes from far RAM */
42d3218
 
42d3218
-unsigned long mget_dword(char FAR *p)
42d3218
+uint32_t mget_dword(char FAR *p)
42d3218
 {
42d3218
- unsigned long w0, w1;
42d3218
+ uint32_t w0, w1;
42d3218
 
42d3218
  w0=mget_word(p);
42d3218
  w1=mget_word(p+2);
42d3218
@@ -2923,7 +2923,7 @@ unsigned long mget_dword(char FAR *p)
42d3218
 
42d3218
 /* Model-independent routine to store 2 bytes in far RAM */
42d3218
 
42d3218
-void mput_word(unsigned int w, char FAR *p)
42d3218
+void mput_word(uint16_t w, char FAR *p)
42d3218
 {
42d3218
  mput_byte(w&0xFF, p);
42d3218
  mput_byte(w>>8  , p+1);
42d3218
@@ -2931,7 +2931,7 @@ void mput_word(unsigned int w, char FAR 
42d3218
 
42d3218
 /* Model-independent routine to store 4 bytes in far RAM */
42d3218
 
42d3218
-void mput_dword(unsigned long d, char FAR *p)
42d3218
+void mput_dword(uint32_t d, char FAR *p)
42d3218
 {
42d3218
  mput_word(d&0xFFFF, p);
42d3218
  mput_word(d>>16   , p+2);
42d3218
Index: b/arj_proc.h
42d3218
===================================================================
42d3218
--- a/arj_proc.h	2008-06-16 08:25:28.000000000 +0300
42d3218
+++ b/arj_proc.h	2008-06-16 08:25:43.000000000 +0300
42d3218
@@ -8,15 +8,17 @@
42d3218
 #ifndef ARJ_PROC_INCLUDED
42d3218
 #define ARJ_PROC_INCLUDED
42d3218
 
42d3218
+#include <stdint.h>
42d3218
+
42d3218
 /* Helper macros */
42d3218
 
42d3218
-#define mget_byte(p) (*(unsigned char FAR *)(p)&0xFF)
42d3218
-#define mput_byte(c, p) *(unsigned char FAR *)(p)=(unsigned char)(c)
42d3218
+#define mget_byte(p) (*(uint8_t FAR *)(p)&0xFF)
42d3218
+#define mput_byte(c, p) *(uint8_t FAR *)(p)=(uint8_t)(c)
42d3218
 #if !defined(ALIGN_POINTERS) && !defined(WORDS_BIGENDIAN)
42d3218
-#define mget_word(p) (*(unsigned short *)(p)&0xFFFF)
42d3218
-#define mput_word(w,p) (*(unsigned short *)(p)=(unsigned short)(w))
42d3218
-#define mget_dword(p) (*(unsigned long *)(p))
42d3218
-#define mput_dword(w,p) (*(unsigned long *)(p)=(unsigned long)(w))
42d3218
+#define mget_word(p) (*(uint16_t *)(p)&0xFFFF)
42d3218
+#define mput_word(w,p) (*(uint16_t *)(p)=(uint16_t)(w))
42d3218
+#define mget_dword(p) (*(uint32_t *)(p))
42d3218
+#define mput_dword(w,p) (*(uint32_t *)(p)=(uint32_t)(w))
42d3218
 #endif
42d3218
 
42d3218
 /* Prototypes */
42d3218
@@ -31,7 +33,7 @@ void copy_bytes(unsigned long nbytes);
42d3218
 int translate_path(char *name);
42d3218
 void restart_proc(char *dest);
42d3218
 int search_for_extension(char *name, char *ext_list);
42d3218
-unsigned long get_volfree(unsigned int increment);
42d3218
+unsigned long get_volfree(unsigned long increment);
42d3218
 unsigned int check_multivolume(unsigned int increment);
42d3218
 void store();
42d3218
 void hollow_encode();
42d3218
@@ -61,10 +63,10 @@ void unpack_mem(struct mempack *mempack)
42d3218
 void strip_lf(char *str);
42d3218
 char *ltrim(char *str);
42d3218
 #if defined(ALIGN_POINTERS) || defined(WORDS_BIGENDIAN)
42d3218
-unsigned int mget_word(char FAR *p);
42d3218
-unsigned long mget_dword(char FAR *p);
42d3218
-void mput_word(unsigned int w, char FAR *p);
42d3218
-void mput_dword(unsigned long d, char FAR *p);
42d3218
+uint16_t mget_word(char FAR *p);
42d3218
+uint32_t mget_dword(char FAR *p);
42d3218
+void mput_word(uint16_t w, char FAR *p);
42d3218
+void mput_dword(uint32_t d, char FAR *p);
42d3218
 #endif
42d3218
 
42d3218
 #endif