update to 5.0

This commit is contained in:
dillon_chen 2022-06-27 13:59:09 +08:00
parent a30c6a4847
commit 47383ce91c
10 changed files with 4 additions and 195 deletions

View File

@ -1,16 +0,0 @@
diff --git a/compress42.c b/compress42.c
index 5d5f049..2807058 100644
--- a/compress42.c
+++ b/compress42.c
@@ -1355,7 +1355,7 @@ compress(fdin, fdout)
REG11 int boff;
REG12 int n_bits;
REG13 int ratio;
- REG14 long checkpoint;
+ REG14 unsigned long long checkpoint;
REG15 code_int extcode;
union
{
--
1.8.3.1

View File

@ -1,16 +0,0 @@
diff --git a/compress42.c b/compress42.c
index 2807058..1d9e375 100644
--- a/compress42.c
+++ b/compress42.c
@@ -468,7 +468,7 @@ typedef unsigned char char_type;
union bytes
{
- long word;
+ int word;
struct
{
#if BYTEORDER == 4321
--
1.8.3.1

View File

@ -1,60 +0,0 @@
diff --git a/compress42.c b/compress42.c
index bec7a2f..ff437e5 100644
--- a/compress42.c
+++ b/compress42.c
@@ -151,6 +151,7 @@
#include <sys/types.h>
#include <sys/stat.h>
#include <errno.h>
+#include <string.h>
#if !defined(DOS) && !defined(WINDOWS)
# include <unistd.h>
@@ -229,6 +230,8 @@ static inline access(const char *pathname, int mode)
# define OBUFSIZ BUFSIZ /* Default output buffer size */
#endif
+#define MAXPATHLEN PATH_MAX /* MAXPATHLEN - maximum length of a pathname we allow */
+
/* Defines for third byte of header */
#define MAGIC_1 (char_type)'\037'/* First byte of compressed file */
#define MAGIC_2 (char_type)'\235'/* Second byte of compressed file */
@@ -713,6 +716,7 @@ main(argc, argv)
REG3 char **filelist;
REG4 char **fileptr;
int seen_double_dash = 0;
+ int i = 0;
#ifdef SIGINT
if ((fgnd_flag = (signal(SIGINT, SIG_IGN)) != SIG_IGN))
@@ -730,13 +734,18 @@ main(argc, argv)
nomagic = 1; /* Original didn't have a magic number */
#endif
- filelist = (char **)malloc(argc*sizeof(char *));
+ for (i=0; i<argc; i++) {
+ if (strlen(argv[i])>(MAXPATHLEN-1)) {
+ fprintf(stderr,"Filename too long\n");
+ exit(1);
+ }
+ }
+ filelist = fileptr = (char **)malloc(argc*sizeof(char *));
if (filelist == NULL)
{
fprintf(stderr, "Cannot allocate memory for file list.\n");
exit (1);
}
- fileptr = filelist;
*filelist = NULL;
if((progname = strrchr(argv[0], '/')) != 0)
@@ -886,7 +895,9 @@ nextarg: continue;
decompress(0, 1);
}
+ free(filelist);
exit((exit_code== -1) ? 1:exit_code);
+ return 0;
}
void

View File

@ -1,23 +0,0 @@
diff --git a/compress42.c b/compress42.c
index 5d5f049..bec7a2f 100644
--- a/compress42.c
+++ b/compress42.c
@@ -140,6 +140,7 @@
# define MINGW
#endif
+#include <unistd.h>
#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>
@@ -549,8 +550,8 @@ int remove_ofname = 0; /* Remove output file on a error */
char *ofname = NULL; /* Output filename */
int fgnd_flag = 0; /* Running in background (SIGINT=SIGIGN) */
-long bytes_in; /* Total number of byte from input */
-long bytes_out; /* Total number of byte to output */
+long long bytes_in; /* Total number of byte from input */
+long long bytes_out; /* Total number of byte to output */
/*
* 8086 & 80286 Has a problem with array bigger than 64K so fake the array

View File

@ -1,23 +0,0 @@
diff --git a/Makefile.def b/Makefile.def
index 0d0e6ba..5763398 100644
--- a/Makefile.def
+++ b/Makefile.def
@@ -32,7 +32,14 @@ MANDIR=$(PREFIX)/share/man/man1
# -DDEF_ERRNO=1 Define errno (not defined in errno.h).
# -DMAXSEG_64K=1 -BITS=16 Support segment processor like 80286.
#
-options= $(CFLAGS) $(CPPFLAGS) -DDIRENT=1 -DUSERMEM=800000 -DREGISTERS=3
+options= $(CFLAGS) $(CPPFLAGS) -DDIRENT=1 -DUSERMEM=800000 -DREGISTERS=20 \
+ -D_FILE_OFFSET_BITS=64 \
+ -D_LARGEFILE_SOURCE \
+ -DNOFUNCDEF=1 \
+ -DOBUFSIZ=1024 \
+ -DUTIME_H \
+ -DSYSDIR=1 \
+ $(ARCH_FLAGS)
# library options
LBOPT= $(LDFLAGS)
--
1.8.3.1

View File

@ -1,12 +0,0 @@
diff -urNp ncompress-4.2.4-orig/compress42.c ncompress-4.2.4/compress42.c
--- ncompress-4.2.4-orig/compress42.c 2012-01-03 15:13:58.014222927 +0100
+++ ncompress-4.2.4/compress42.c 2012-01-03 15:15:17.117097419 +0100
@@ -1441,7 +1441,7 @@ compress(fdin, fdout)
boff = -(((OBUFSIZ<<3)-boff)%(n_bits<<3));
bytes_out += OBUFSIZ;
- memcpy(outbuf, outbuf+OBUFSIZ, (outbits>>3)+1);
+ memmove(outbuf, outbuf+OBUFSIZ, (outbits>>3)+1);
memset(outbuf+(outbits>>3)+1, '\0', OBUFSIZ);
}

Binary file not shown.

BIN
ncompress-5.0.tar.gz Normal file

Binary file not shown.

View File

@ -1,34 +0,0 @@
From c3644836a013841efd385a05e6f250985c024dfe Mon Sep 17 00:00:00 2001
From: hexiaowen <hexiaowen@huawei.com>
Date: Fri, 3 May 2019 16:06:24 +0800
Subject: [PATCH] ncompress: compression with 9 bits don't work
---
compress42.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/compress42.c b/compress42.c
index 834c2f2..19a4043 100644
--- a/compress42.c
+++ b/compress42.c
@@ -233,7 +233,7 @@
#define FIRST 257 /* first free entry */
#define CLEAR 256 /* table clear output code */
-#define INIT_BITS 9 /* initial number of bits/code */
+#define INIT_BITS 8 /* initial number of bits/code */
#ifndef SACREDMEM
/*
@@ -835,7 +835,7 @@ main(argc, argv)
nextarg: continue;
}
- if (maxbits < INIT_BITS) maxbits = INIT_BITS;
+ if (maxbits <= INIT_BITS) maxbits = INIT_BITS + 1;
if (maxbits > BITS) maxbits = BITS;
if (*filelist != NULL)
--
1.8.3.1

View File

@ -1,20 +1,11 @@
Name: ncompress Name: ncompress
Version: 4.2.4.6 Version: 5.0
Release: 1 Release: 1
Summary: A fast, simple LZW file compressor Summary: A fast, simple LZW file compressor
License: Public Domain License: Public Domain
URL: http://ncompress.sourceforge.net/ URL: http://ncompress.sourceforge.net/
Source0: https://github.com/vapier/%{name}/archive/v%{version}.tar.gz#/%{name}-%{version}.tar.gz Source0: https://github.com/vapier/%{name}/archive/v%{version}.tar.gz#/%{name}-%{version}.tar.gz
Patch0: %{name}-4.2.4.4-make.patch
Patch1: %{name}-4.2.4.4-lfs.patch
Patch2: %{name}-4.2.4.4-filenamelen.patch
Patch3: %{name}-4.2.4.4-2GB.patch
Patch4: %{name}-4.2.4.4-endians.patch
Patch5: %{name}-4.2.4.4-memmove.patch
Patch6000: ncompress-compression-with-9-bits-don-t-work.patch
BuildRequires: git gcc glibc-devel BuildRequires: git gcc glibc-devel
%description %description
@ -48,6 +39,9 @@ ln -sf compress.1 %{buildroot}%{_mandir}/man1/uncompress.1
%{_mandir}/man1/*.gz %{_mandir}/man1/*.gz
%changelog %changelog
* Mon Jun 27 2022 dillon chen <dillon.chen@gmail.com> -5.0-1
- update to 5.0
* Tue Feb 02 2021 shixuantong<shixuantong@huawei.com> - 4.2.4.6-1 * Tue Feb 02 2021 shixuantong<shixuantong@huawei.com> - 4.2.4.6-1
- Type:enhancement - Type:enhancement
- ID:NA - ID:NA
@ -80,4 +74,3 @@ ln -sf compress.1 %{buildroot}%{_mandir}/man1/uncompress.1
* Wed Aug 22 2018 openEuler Buildteam <buildteam@openeuler.org> - 4.2.4.4-14 * Wed Aug 22 2018 openEuler Buildteam <buildteam@openeuler.org> - 4.2.4.4-14
- Package init - Package init