mirror of
https://git.FreeBSD.org/ports.git
synced 2024-11-27 00:57:50 +00:00
Ubreak (see the new patch-math-remainder), resolve most of the warnings,
enable tests (regression-test).
This commit is contained in:
parent
de8b4e1915
commit
fe7a729749
Notes:
svn2git
2021-03-31 03:12:20 +00:00
svn path=/head/; revision=382010
@ -25,16 +25,15 @@ RUBY_SHEBANG_FILES= ${EXAMPLES}
|
||||
|
||||
OPTIONS_DEFINE= DOCS
|
||||
|
||||
# We don't have executables in this package, but rake uses
|
||||
# INSTALL_PROG for shared libraries:
|
||||
MAKE_ARGS= INSTALL_PROG="${INSTALL_LIB}"
|
||||
|
||||
post-install:
|
||||
@${MKDIR} ${STAGEDIR}${RUBY_MODEXAMPLESDIR}
|
||||
${INSTALL_SCRIPT} ${EXAMPLES:S,^,${WRKSRC}/,} ${STAGEDIR}${RUBY_MODEXAMPLESDIR}
|
||||
|
||||
.include <bsd.port.pre.mk>
|
||||
test check regression-test: build
|
||||
cd ${WRKSRC}/test && ${RUBY} -I${WRKSRC} test.rb
|
||||
|
||||
.if ${RUBY_VER} >= 2.0
|
||||
BROKEN= Does not build with Ruby 2.0 or Ruby 2.1
|
||||
.endif
|
||||
DEPRECATED= Does not work with Ruby 2.x
|
||||
EXPIRATION_DATE= 2015-03-28
|
||||
|
||||
.include <bsd.port.post.mk>
|
||||
.include <bsd.port.mk>
|
||||
|
55
archivers/ruby-lha/files/patch-math-remainder
Normal file
55
archivers/ruby-lha/files/patch-math-remainder
Normal file
@ -0,0 +1,55 @@
|
||||
Ruby 2.x #includes <math.h>, which declares a function named
|
||||
remainder(). We must rename our variable to avoid name-conflict
|
||||
and allow this code to compile with Ruby-2.x
|
||||
|
||||
-mi
|
||||
|
||||
--- ext/slide.c 2006-09-17 13:45:51.000000000 -0400
|
||||
+++ ext/slide.c 2015-03-23 10:27:10.000000000 -0400
|
||||
@@ -88,5 +88,5 @@
|
||||
static unsigned int txtsiz;
|
||||
static unsigned long dicsiz;
|
||||
-static unsigned int remainder;
|
||||
+static unsigned int iremainder;
|
||||
|
||||
struct matchdata {
|
||||
@@ -163,5 +163,5 @@
|
||||
n = fread_crc(crc, &text[txtsiz - dicsiz], dicsiz, infile);
|
||||
|
||||
- remainder += n;
|
||||
+ iremainder += n;
|
||||
|
||||
*pos -= dicsiz;
|
||||
@@ -271,5 +271,5 @@
|
||||
search_dict_1(token, pos, 0, off+2, m);
|
||||
|
||||
- if (m->len > remainder) m->len = remainder;
|
||||
+ if (m->len > iremainder) m->len = iremainder;
|
||||
}
|
||||
|
||||
@@ -281,5 +281,5 @@
|
||||
unsigned int *crc;
|
||||
{
|
||||
- remainder--;
|
||||
+ iremainder--;
|
||||
if (++*pos >= txtsiz - maxmatch) {
|
||||
update_dict(pos, crc);
|
||||
@@ -317,9 +317,9 @@
|
||||
memset(text, ' ', TXTSIZ);
|
||||
|
||||
- remainder = fread_crc(&crc, &text[dicsiz], txtsiz-dicsiz, infile);
|
||||
+ iremainder = fread_crc(&crc, &text[dicsiz], txtsiz-dicsiz, infile);
|
||||
|
||||
match.len = THRESHOLD - 1;
|
||||
match.off = 0;
|
||||
- if (match.len > remainder) match.len = remainder;
|
||||
+ if (match.len > iremainder) match.len = iremainder;
|
||||
|
||||
pos = dicsiz;
|
||||
@@ -327,5 +327,5 @@
|
||||
insert_hash(token, pos); /* associate token and pos */
|
||||
|
||||
- while (remainder > 0 && ! unpackable) {
|
||||
+ while (iremainder > 0 && ! unpackable) {
|
||||
last = match;
|
||||
|
9
archivers/ruby-lha/files/patch-tests
Normal file
9
archivers/ruby-lha/files/patch-tests
Normal file
@ -0,0 +1,9 @@
|
||||
--- test/test.rb 2006-09-17 14:32:52.000000000 -0400
|
||||
+++ test/test.rb 2015-03-23 11:18:00.000000000 -0400
|
||||
@@ -21,5 +21,5 @@
|
||||
obuff = ' ' * 256
|
||||
(0..255).each do |x|
|
||||
- obuff[x] = x
|
||||
+ obuff[x] = x.chr
|
||||
end
|
||||
nbuff = nil
|
326
archivers/ruby-lha/files/patch-warnings
Normal file
326
archivers/ruby-lha/files/patch-warnings
Normal file
@ -0,0 +1,326 @@
|
||||
--- ext/crcio.c 2006-09-17 12:38:22.000000000 -0400
|
||||
+++ ext/crcio.c 2015-03-23 10:29:59.000000000 -0400
|
||||
@@ -34,9 +34,11 @@
|
||||
/* ------------------------------------------------------------------------ */
|
||||
unsigned int
|
||||
-calccrc(crc, p, n)
|
||||
+calccrc(crc, _p, n)
|
||||
unsigned int crc;
|
||||
- unsigned char *p;
|
||||
+ const void *_p;
|
||||
unsigned int n;
|
||||
{
|
||||
+ const unsigned char *p = _p;
|
||||
+
|
||||
while (n-- > 0)
|
||||
crc = UPDATE_CRC(crc, *p++);
|
||||
@@ -68,5 +70,5 @@
|
||||
fwrite_crc(crcp, p, n, fp)
|
||||
unsigned int *crcp;
|
||||
- unsigned char *p;
|
||||
+ const unsigned char *p;
|
||||
int n;
|
||||
FILE *fp;
|
||||
@@ -139,9 +141,11 @@
|
||||
/* ------------------------------------------------------------------------ */
|
||||
int
|
||||
-fwrite_txt(p, n, fp)
|
||||
- unsigned char *p;
|
||||
+fwrite_txt(_p, n, fp)
|
||||
+ const void *_p;
|
||||
int n;
|
||||
FILE *fp;
|
||||
{
|
||||
+ const unsigned char *p = _p;
|
||||
+
|
||||
while (--n >= 0) {
|
||||
if (*p != '\015' && *p != '\032') {
|
||||
@@ -161,6 +165,6 @@
|
||||
/* ------------------------------------------------------------------------ */
|
||||
int
|
||||
-fread_txt(p, n, fp)
|
||||
- unsigned char *p;
|
||||
+fread_txt(_p, n, fp)
|
||||
+ void *_p;
|
||||
int n;
|
||||
FILE *fp;
|
||||
@@ -168,4 +172,5 @@
|
||||
int c;
|
||||
int cnt = 0;
|
||||
+ unsigned char *p = _p;
|
||||
|
||||
while (cnt < n) {
|
||||
--- ext/extract.c 2006-09-17 13:45:51.000000000 -0400
|
||||
+++ ext/extract.c 2015-03-23 10:42:48.000000000 -0400
|
||||
@@ -15,5 +15,5 @@
|
||||
size_t original_size;
|
||||
size_t packed_size;
|
||||
- char *name;
|
||||
+ const char *name;
|
||||
int method;
|
||||
size_t *read_sizep;
|
||||
--- ext/header.c 2006-09-17 12:38:22.000000000 -0400
|
||||
+++ ext/header.c 2015-03-23 10:54:36.000000000 -0400
|
||||
@@ -49,10 +49,11 @@
|
||||
#endif
|
||||
|
||||
-int
|
||||
-calc_sum(p, len)
|
||||
- char *p;
|
||||
+static int
|
||||
+calc_sum(_p, len)
|
||||
+ const void *_p;
|
||||
int len;
|
||||
{
|
||||
int sum = 0;
|
||||
+ const char *p = _p;
|
||||
|
||||
while (len--) sum += *p++;
|
||||
@@ -68,5 +69,5 @@
|
||||
|
||||
if (verbose_listing && verbose > 1)
|
||||
- printf("%02d %2d: ", get_ptr - start_ptr, 1);
|
||||
+ printf("%02td %2d: ", get_ptr - start_ptr, 1);
|
||||
c = GET_BYTE();
|
||||
if (verbose_listing && verbose > 1) {
|
||||
@@ -85,5 +86,5 @@
|
||||
if (len == 0) return;
|
||||
if (verbose_listing && verbose > 1) {
|
||||
- printf("%02d %2d: ", get_ptr - start_ptr, len);
|
||||
+ printf("%02td %2d: ", get_ptr - start_ptr, len);
|
||||
while (len--)
|
||||
printf("0x%02x ", GET_BYTE());
|
||||
@@ -103,5 +104,5 @@
|
||||
#if DUMP_HEADER
|
||||
if (verbose_listing && verbose > 1)
|
||||
- printf("%02d %2d: ", get_ptr - start_ptr, 2);
|
||||
+ printf("%02td %2d: ", get_ptr - start_ptr, 2);
|
||||
#endif
|
||||
b0 = GET_BYTE();
|
||||
@@ -131,5 +132,5 @@
|
||||
#if DUMP_HEADER
|
||||
if (verbose_listing && verbose > 1)
|
||||
- printf("%02d %2d: ", get_ptr - start_ptr, 4);
|
||||
+ printf("%02td %2d: ", get_ptr - start_ptr, 4);
|
||||
#endif
|
||||
b0 = GET_BYTE();
|
||||
@@ -164,5 +165,5 @@
|
||||
#if DUMP_HEADER
|
||||
if (verbose_listing && verbose > 1)
|
||||
- printf("%02d %2d: \"", get_ptr - start_ptr, len);
|
||||
+ printf("%02td %2d: \"", get_ptr - start_ptr, len);
|
||||
|
||||
for (i = 0; i < len; i++) {
|
||||
@@ -1172,9 +1173,9 @@
|
||||
|
||||
/* remove leading `xxxx/..' */
|
||||
-static char *
|
||||
-remove_leading_dots(char *path)
|
||||
+static const char *
|
||||
+remove_leading_dots(const char *path)
|
||||
{
|
||||
- char *first = path;
|
||||
- char *ptr = 0;
|
||||
+ const char *first = path;
|
||||
+ const char *ptr = NULL;
|
||||
|
||||
if (strcmp(first, "..") == 0) {
|
||||
@@ -1201,5 +1202,5 @@
|
||||
|
||||
if (ptr) {
|
||||
- warning("Removing leading `%.*s' from member name.", ptr-first, first);
|
||||
+ warning("Removing leading `%.*s' from member name.", (int)(ptr - first), first);
|
||||
return ptr;
|
||||
}
|
||||
--- ext/huf.c 2006-09-17 12:38:22.000000000 -0400
|
||||
+++ ext/huf.c 2015-03-23 10:37:51.000000000 -0400
|
||||
@@ -235,7 +235,5 @@
|
||||
/* lh4, 5, 6, 7 */
|
||||
void
|
||||
-output_st1(c, p)
|
||||
- unsigned short c;
|
||||
- unsigned short p;
|
||||
+output_st1(unsigned short c, unsigned short p)
|
||||
{
|
||||
static unsigned short cpos;
|
||||
--- ext/lha.h 2006-09-18 04:53:29.000000000 -0400
|
||||
+++ ext/lha.h 2015-03-23 11:03:01.000000000 -0400
|
||||
@@ -212,4 +212,6 @@
|
||||
#include "lha_macro.h"
|
||||
|
||||
+unsigned char *alloc_buf(void);
|
||||
+
|
||||
#define exit(n) lha_exit(n)
|
||||
|
||||
@@ -301,32 +303,34 @@
|
||||
LHALIB_EXTERN boolean need_file(const char*);
|
||||
LHALIB_EXTERN boolean archive_is_msdos_sfx1(const char*);
|
||||
-LHALIB_EXTERN void output_dyn();
|
||||
-LHALIB_EXTERN void encode_start_fix();
|
||||
-LHALIB_EXTERN void encode_end_dyn();
|
||||
-LHALIB_EXTERN void output_st1();
|
||||
-LHALIB_EXTERN void encode_start_st0();
|
||||
-LHALIB_EXTERN void encode_end_st0();
|
||||
-LHALIB_EXTERN void encode_start_st1();
|
||||
-LHALIB_EXTERN void encode_end_st1();
|
||||
-LHALIB_EXTERN unsigned short decode_c_dyn();
|
||||
-LHALIB_EXTERN unsigned short decode_p_dyn();
|
||||
-LHALIB_EXTERN void decode_start_fix();
|
||||
-LHALIB_EXTERN void decode_start_dyn();
|
||||
-LHALIB_EXTERN void decode_start_st0();
|
||||
-LHALIB_EXTERN void decode_start_st1();
|
||||
-LHALIB_EXTERN unsigned short decode_c_st0();
|
||||
-LHALIB_EXTERN unsigned short decode_c_st1();
|
||||
-LHALIB_EXTERN unsigned short decode_p_st0();
|
||||
-LHALIB_EXTERN unsigned short decode_p_st1();
|
||||
-LHALIB_EXTERN unsigned short decode_c_lzs();
|
||||
-LHALIB_EXTERN unsigned short decode_p_lzs();
|
||||
-LHALIB_EXTERN void decode_start_lzs();
|
||||
-LHALIB_EXTERN unsigned short decode_c_lz5();
|
||||
-LHALIB_EXTERN unsigned short decode_p_lz5();
|
||||
-LHALIB_EXTERN void decode_start_lz5();
|
||||
-LHALIB_EXTERN void make_crctable();
|
||||
+LHALIB_EXTERN void output_dyn(unsigned int code, unsigned int pos);
|
||||
+LHALIB_EXTERN void encode_start_fix(void);
|
||||
+LHALIB_EXTERN void encode_end_dyn(void);
|
||||
+LHALIB_EXTERN void output_st1(unsigned short c, unsigned short p);
|
||||
+LHALIB_EXTERN void encode_start_st0(void);
|
||||
+LHALIB_EXTERN void encode_end_st0(void);
|
||||
+LHALIB_EXTERN void encode_start_st1(void);
|
||||
+LHALIB_EXTERN void encode_end_st1(void);
|
||||
+LHALIB_EXTERN void start_c_dyn(void);
|
||||
+LHALIB_EXTERN unsigned short decode_c_dyn(void);
|
||||
+LHALIB_EXTERN unsigned short decode_p_dyn(void);
|
||||
+LHALIB_EXTERN void decode_start_fix(void);
|
||||
+LHALIB_EXTERN void decode_start_dyn(void);
|
||||
+LHALIB_EXTERN void decode_start_st0(void);
|
||||
+LHALIB_EXTERN void decode_start_st1(void);
|
||||
+LHALIB_EXTERN unsigned short decode_c_st0(void);
|
||||
+LHALIB_EXTERN unsigned short decode_c_st1(void);
|
||||
+LHALIB_EXTERN unsigned short decode_p_st0(void);
|
||||
+LHALIB_EXTERN unsigned short decode_p_st1(void);
|
||||
+LHALIB_EXTERN unsigned short decode_c_lzs(void);
|
||||
+LHALIB_EXTERN unsigned short decode_p_lzs(void);
|
||||
+LHALIB_EXTERN void decode_start_lzs(void);
|
||||
+LHALIB_EXTERN unsigned short decode_c_lz5(void);
|
||||
+LHALIB_EXTERN unsigned short decode_p_lz5(void);
|
||||
+LHALIB_EXTERN void decode_start_lz5(void);
|
||||
+LHALIB_EXTERN void make_crctable(void);
|
||||
LHALIB_EXTERN size_t copyfile(FILE* f1, FILE* f2, size_t size, int text_flg, unsigned int* crcp);
|
||||
-LHALIB_EXTERN void init_getbits();
|
||||
-LHALIB_EXTERN void init_code_cache();
|
||||
+LHALIB_EXTERN void init_getbits(void);
|
||||
+LHALIB_EXTERN void init_putbits(void);
|
||||
+LHALIB_EXTERN void init_code_cache(void);
|
||||
LHALIB_EXTERN void putcode(unsigned char n, unsigned short x);
|
||||
LHALIB_EXTERN void putbits(unsigned char n, unsigned short x);
|
||||
@@ -335,5 +339,18 @@
|
||||
LHALIB_EXTERN void encode_p_st0(unsigned short j);
|
||||
|
||||
-
|
||||
+NORETURN(void lha_exit(int n));
|
||||
+unsigned int calccrc(unsigned int crc, const void *p, unsigned int length);
|
||||
+int fread_txt(void *p, int n, FILE *fp);
|
||||
+int fwrite_txt(const void *p, int n, FILE *fp);
|
||||
+int fread_crc(unsigned int *crcp, unsigned char *p, int n, FILE *fp);
|
||||
+void fwrite_crc(unsigned int *crcp, const unsigned char *p, int n, FILE *fp);
|
||||
+void make_table(short nchar, const unsigned char bitlenp[], short tablebits, unsigned short table[]);
|
||||
+unsigned int decode(struct interfacing *intf);
|
||||
+short make_tree(int nchar, unsigned short *freqp, unsigned char *bitlenp, unsigned short *codep);
|
||||
+int str_safe_copy(char *dst, const char *src, int dstsz);
|
||||
+int decode_lzhuf(FILE *in, FILE *out, size_t original, size_t packed, const char *name, int method, size_t *readp);
|
||||
+int seek_lha_header(FILE *fp);
|
||||
+boolean get_header(FILE *fp, LzHeader *hdr);
|
||||
+PRINTF_ARGS(int xsnprintf(char *dst, size_t size, const char *fmt, ...), 3, 4);
|
||||
|
||||
#define start_indicator(name, size, ing, len) 0
|
||||
--- ext/lhalib.c 2006-09-18 05:11:35.000000000 -0400
|
||||
+++ ext/lhalib.c 2015-03-23 11:00:35.000000000 -0400
|
||||
@@ -19,5 +19,5 @@
|
||||
|
||||
#include "lha.h"
|
||||
-#include "st.h"
|
||||
+#include <ruby/st.h>
|
||||
|
||||
static VALUE lhalib;
|
||||
@@ -76,5 +76,5 @@
|
||||
proc = Qnil;
|
||||
rb_scan_args(argc, argv, "1&", &file, &proc);
|
||||
- rb_check_safe_str(file);
|
||||
+ SafeStringValue(file);
|
||||
rb_secure(4);
|
||||
|
||||
--- ext/lharc.c 2006-09-17 12:38:22.000000000 -0400
|
||||
+++ ext/lharc.c 2015-03-23 10:58:33.000000000 -0400
|
||||
@@ -53,5 +53,5 @@
|
||||
static boolean
|
||||
open_old_archive_1(name, v_fp)
|
||||
- char *name;
|
||||
+ const char *name;
|
||||
FILE **v_fp;
|
||||
{
|
||||
--- ext/lhext.c 2006-09-17 12:38:22.000000000 -0400
|
||||
+++ ext/lhext.c 2015-03-23 10:41:48.000000000 -0400
|
||||
@@ -27,6 +27,7 @@
|
||||
};
|
||||
|
||||
-static void add_dirinfo(char* name, LzHeader* hdr);
|
||||
-static void adjust_dirinfo();
|
||||
+static void add_dirinfo(const char* name, LzHeader* hdr);
|
||||
+static void adjust_dirinfo(void);
|
||||
+static int is_directory_traversal(const char *path);
|
||||
|
||||
/* ------------------------------------------------------------------------ */
|
||||
@@ -396,6 +397,6 @@
|
||||
}
|
||||
|
||||
-int
|
||||
-is_directory_traversal(char *path)
|
||||
+static int
|
||||
+is_directory_traversal(const char *path)
|
||||
{
|
||||
int state = 0;
|
||||
@@ -437,5 +438,5 @@
|
||||
static LzHeaderList *dirinfo;
|
||||
|
||||
-static void add_dirinfo(char *name, LzHeader *hdr)
|
||||
+static void add_dirinfo(const char *name, LzHeader *hdr)
|
||||
{
|
||||
LzHeaderList *p;
|
||||
--- ext/maketbl.c 2006-09-17 12:38:22.000000000 -0400
|
||||
+++ ext/maketbl.c 2015-03-23 10:32:06.000000000 -0400
|
||||
@@ -10,9 +10,6 @@
|
||||
|
||||
void
|
||||
-make_table(nchar, bitlen, tablebits, table)
|
||||
- short nchar;
|
||||
- unsigned char bitlen[];
|
||||
- short tablebits;
|
||||
- unsigned short table[];
|
||||
+make_table(short nchar, const unsigned char bitlen[], short tablebits,
|
||||
+ unsigned short table[])
|
||||
{
|
||||
unsigned short count[17]; /* count of bitlen */
|
||||
--- ext/maketree.c 2006-09-17 13:36:33.000000000 -0400
|
||||
+++ ext/maketree.c 2015-03-23 11:02:50.000000000 -0400
|
||||
@@ -96,5 +96,5 @@
|
||||
short *heap;
|
||||
size_t heapsize;
|
||||
- unsigned short *freq;
|
||||
+ const unsigned short *freq;
|
||||
{
|
||||
short j, k;
|
||||
--- ext/util.c 2006-09-18 04:53:29.000000000 -0400
|
||||
+++ ext/util.c 2015-03-23 10:57:53.000000000 -0400
|
||||
@@ -115,8 +115,9 @@
|
||||
int
|
||||
#if STDC_HEADERS
|
||||
-xsnprintf(char *dest, size_t size, char *fmt, ...)
|
||||
+xsnprintf(char *dest, size_t size, const char *fmt, ...)
|
||||
#else
|
||||
xsnprintf(dest, size, fmt, va_alist)
|
||||
- char *dest, *fmt;
|
||||
+ char *dest;
|
||||
+ const char *fmt;
|
||||
size_t size;
|
||||
va_dcl
|
Loading…
Reference in New Issue
Block a user