aboutsummaryrefslogtreecommitdiff
path: root/archivers/arj
diff options
context:
space:
mode:
authorRenato Botelho <garga@FreeBSD.org>2010-02-23 10:56:25 +0000
committerRenato Botelho <garga@FreeBSD.org>2010-02-23 10:56:25 +0000
commit489b2ee68117578110b991edecf4864c286749b7 (patch)
tree6bb37a635e7463df6397bb75f39e7dc3e526f9e2 /archivers/arj
parentf182cf669e3b1488c584b8a12f4b7beaba6cce99 (diff)
downloadports-489b2ee68117578110b991edecf4864c286749b7.tar.gz
ports-489b2ee68117578110b991edecf4864c286749b7.zip
Fix segfault on amd64
Reported by: alex at to.govorit.ru Obtained from: Arj's author Tested by: Guilherme M. Schroeder <lero420 at gmail.com> Feature safe: yes
Notes
Notes: svn path=/head/; revision=250224
Diffstat (limited to 'archivers/arj')
-rw-r--r--archivers/arj/Makefile2
-rw-r--r--archivers/arj/files/patch-arj_arcv.c61
-rw-r--r--archivers/arj/files/patch-arj_proc.c80
-rw-r--r--archivers/arj/files/patch-arj_proc.h50
4 files changed, 192 insertions, 1 deletions
diff --git a/archivers/arj/Makefile b/archivers/arj/Makefile
index 1fb7c6dfa452..5a714274af30 100644
--- a/archivers/arj/Makefile
+++ b/archivers/arj/Makefile
@@ -7,7 +7,7 @@
PORTNAME= arj
PORTVERSION= 3.10.22
-PORTREVISION= 2
+PORTREVISION= 3
CATEGORIES= archivers
MASTER_SITES= SF/${PORTNAME}/${PORTNAME}/2.78_3.10%20build%2022
diff --git a/archivers/arj/files/patch-arj_arcv.c b/archivers/arj/files/patch-arj_arcv.c
new file mode 100644
index 000000000000..e65faa41f9cc
--- /dev/null
+++ b/archivers/arj/files/patch-arj_arcv.c
@@ -0,0 +1,61 @@
+--- arj_arcv.c 2005-06-21 22:53:12.000000000 +0300
++++ arj_arcv.c 2005-11-24 02:50:31.000000000 +0200
+@@ -59,27 +59,27 @@
+ #define setup_hput(ptr) (tmp_hptr=(ptr))
+
+ #define hget_byte() (*(tmp_hptr++)&0xFF)
+-#define hput_byte(c) (*(tmp_hptr++)=(char) (c))
++#define hput_byte(c) (*(tmp_hptr++)=(uint8_t) (c))
+
+ /* Reads two bytes from the header, incrementing the pointer */
+
+-static unsigned int hget_word()
++static uint16_t hget_word()
+ {
+- unsigned int result;
++ uint16_t result;
+
+ result=mget_word(tmp_hptr);
+- tmp_hptr+=sizeof(short);
++ tmp_hptr+=sizeof(uint16_t);
+ return result;
+ }
+
+ /* Reads four bytes from the header, incrementing the pointer */
+
+-static unsigned long hget_longword()
++static uint32_t hget_longword()
+ {
+- unsigned long result;
++ uint32_t result;
+
+ result=mget_dword(tmp_hptr);
+- tmp_hptr+=sizeof(unsigned long);
++ tmp_hptr+=sizeof(uint32_t);
+ return result;
+ }
+
+@@ -87,18 +87,18 @@
+
+ /* Writes two bytes to the header, incrementing the pointer */
+
+-static void hput_word(unsigned int w)
++static void hput_word(uint16_t w)
+ {
+ mput_word(w,tmp_hptr);
+- tmp_hptr+=sizeof(unsigned short);
++ tmp_hptr+=sizeof(uint16_t);
+ }
+
+ /* Writes four bytes to the header, incrementing the pointer */
+
+-static void hput_longword(unsigned long l)
++static void hput_longword(uint32_t l)
+ {
+ mput_dword(l,tmp_hptr);
+- tmp_hptr+=sizeof(unsigned long);
++ tmp_hptr+=sizeof(uint32_t);
+ }
+
+ /* Calculates and stores the basic header size */
+diff -Naur -x .svn -x CVS arj-3.10.22.orig/arj_proc.c arj-3.10.22/arj_proc.c
diff --git a/archivers/arj/files/patch-arj_proc.c b/archivers/arj/files/patch-arj_proc.c
new file mode 100644
index 000000000000..c8a27fcf44cc
--- /dev/null
+++ b/archivers/arj/files/patch-arj_proc.c
@@ -0,0 +1,80 @@
+--- arj_proc.c 2005-11-24 02:50:19.000000000 +0200
++++ arj_proc.c 2005-11-24 02:50:31.000000000 +0200
+@@ -585,7 +585,7 @@
+ /* Returns the exact amount of data that could be safely written to the
+ destination volume */
+
+-unsigned long get_volfree(unsigned int increment)
++unsigned long get_volfree(unsigned long increment)
+ {
+ unsigned long pvol;
+ unsigned int arjsec_overhead;
+@@ -605,7 +605,7 @@
+ remain=volume_limit-ftell(aostream)-pvol-(long)arjsec_overhead-
+ (long)out_bytes-(long)cpos-(long)ext_voldata-
+ MULTIVOLUME_RESERVE-t_volume_offset;
+- return((unsigned long)min(remain, (unsigned long)increment));
++ return((unsigned long)min(remain, increment));
+ }
+
+ /* Performs various checks when multivolume data is packed to predict an
+@@ -2466,14 +2466,14 @@
+ *tsptr='\0';
+ endptr=tsptr;
+ tsptr=sptr;
+- while((unsigned int)tsptr<(unsigned int)endptr&&patterns<SEARCH_STR_MAX)
++ while((intptr_t)tsptr<(intptr_t)endptr&&patterns<SEARCH_STR_MAX)
+ {
+ while(*tsptr=='\0')
+ tsptr++;
+- if((unsigned int)tsptr<(unsigned int)endptr)
++ if((intptr_t)tsptr<(intptr_t)endptr)
+ {
+ search_str[patterns++]=tsptr;
+- while(*tsptr!='\0'&&(unsigned int)tsptr<(unsigned int)endptr)
++ while(*tsptr!='\0'&&(intptr_t)tsptr<(intptr_t)endptr)
+ tsptr++;
+ }
+ }
+@@ -2901,9 +2901,9 @@
+ #if (defined(WORDS_BIGENDIAN) || defined(ALIGN_POINTERS)) && !defined(ARJDISP) && !defined(REGISTER)
+ /* Model-independent routine to get 2 bytes from far RAM */
+
+-unsigned int mget_word(char FAR *p)
++uint16_t mget_word(char FAR *p)
+ {
+- unsigned int b0, b1;
++ uint16_t b0, b1;
+
+ b0=mget_byte(p);
+ b1=mget_byte(p+1);
+@@ -2912,9 +2912,9 @@
+
+ /* Model-independent routine to get 4 bytes from far RAM */
+
+-unsigned long mget_dword(char FAR *p)
++uint32_t mget_dword(char FAR *p)
+ {
+- unsigned long w0, w1;
++ uint32_t w0, w1;
+
+ w0=mget_word(p);
+ w1=mget_word(p+2);
+@@ -2923,7 +2923,7 @@
+
+ /* Model-independent routine to store 2 bytes in far RAM */
+
+-void mput_word(unsigned int w, char FAR *p)
++void mput_word(uint16_t w, char FAR *p)
+ {
+ mput_byte(w&0xFF, p);
+ mput_byte(w>>8 , p+1);
+@@ -2931,7 +2931,7 @@
+
+ /* Model-independent routine to store 4 bytes in far RAM */
+
+-void mput_dword(unsigned long d, char FAR *p)
++void mput_dword(uint32_t d, char FAR *p)
+ {
+ mput_word(d&0xFFFF, p);
+ mput_word(d>>16 , p+2);
diff --git a/archivers/arj/files/patch-arj_proc.h b/archivers/arj/files/patch-arj_proc.h
new file mode 100644
index 000000000000..9501e70c08af
--- /dev/null
+++ b/archivers/arj/files/patch-arj_proc.h
@@ -0,0 +1,50 @@
+--- arj_proc.h.orig 2004-01-25 08:39:30.000000000 -0200
++++ arj_proc.h 2010-02-19 08:35:05.000000000 -0200
+@@ -8,15 +8,17 @@
+ #ifndef ARJ_PROC_INCLUDED
+ #define ARJ_PROC_INCLUDED
+
++#include <stdint.h>
++
+ /* Helper macros */
+
+-#define mget_byte(p) (*(unsigned char FAR *)(p)&0xFF)
+-#define mput_byte(c, p) *(unsigned char FAR *)(p)=(unsigned char)(c)
++#define mget_byte(p) (*(uint8_t FAR *)(p)&0xFF)
++#define mput_byte(c, p) *(uint8_t FAR *)(p)=(uint8_t)(c)
+ #ifndef WORDS_BIGENDIAN
+-#define mget_word(p) (*(unsigned short *)(p)&0xFFFF)
+-#define mput_word(w,p) (*(unsigned short *)(p)=(unsigned short)(w))
+-#define mget_dword(p) (*(unsigned long *)(p))
+-#define mput_dword(w,p) (*(unsigned long *)(p)=(unsigned long)(w))
++#define mget_word(p) (*(uint16_t *)(p)&0xFFFF)
++#define mput_word(w,p) (*(uint16_t *)(p)=(uint16_t)(w))
++#define mget_dword(p) (*(uint32_t *)(p))
++#define mput_dword(w,p) (*(uint32_t *)(p)=(uint32_t)(w))
+ #endif
+
+ /* Prototypes */
+@@ -31,7 +33,7 @@
+ int translate_path(char *name);
+ void restart_proc(char *dest);
+ int search_for_extension(char *name, char *ext_list);
+-unsigned long get_volfree(unsigned int increment);
++unsigned long get_volfree(unsigned long increment);
+ unsigned int check_multivolume(unsigned int increment);
+ void store();
+ void hollow_encode();
+@@ -61,10 +63,10 @@
+ void strip_lf(char *str);
+ char *ltrim(char *str);
+ #ifdef WORDS_BIGENDIAN
+-unsigned int mget_word(char FAR *p);
+-unsigned long mget_dword(char FAR *p);
+-void mput_word(unsigned int w, char FAR *p);
+-void mput_dword(unsigned long d, char FAR *p);
++uint16_t mget_word(char FAR *p);
++uint32_t mget_dword(char FAR *p);
++void mput_word(uint16_t w, char FAR *p);
++void mput_dword(uint32_t d, char FAR *p);
+ #endif
+
+ #endif