lha icon indicating copy to clipboard operation
lha copied to clipboard

C89 patch

Open polluks opened this issue 1 year ago • 5 comments

See https://github.com/macports/macports-ports/blob/master/archivers/lha/files/c89.patch

polluks avatar Jan 12 '24 13:01 polluks

Why is this change necessary?

jca02266 avatar Jan 13 '24 03:01 jca02266

If you use an old compiler which does not support C99 by default.

polluks avatar Jan 13 '24 10:01 polluks

I can't imagine what the problem is with the c89 compiler. If an error occurs in the original source, I would like to see the contents of that error.

jca02266 avatar Jan 14 '24 22:01 jca02266

@polluks I can't reproduce this issue on Linux. Since you're trying to upstream a patch for MacPorts, I presume you're trying to add support for a Mac - but what kind? Please tell us your exact target platform, your toolset, and reproduction steps.

@jca02266 I cannot reproduce this error, but there is another. Reproduction steps:

CFLAGS="-O2 -g -std=c89" ./configure
make

Results:

gcc -DHAVE_CONFIG_H -I. -I..  -DEUC -DSUPPORT_LH7   -O2 -g -std=c89 -MT pm2tree.o -MD -MP -MF .deps/pm2tree.Tpo -c -o pm2tree.o pm2tree.c
pm2tree.c: In function ‘maketree2’:
pm2tree.c:111:5: error: C++ style comments are not allowed in ISO C90
  111 |     // Note: count == 0 is possible!
      |     ^
pm2tree.c:111:5: note: (this will be reported only once per input file)

Patch:

--- a/src/pm2tree.c
+++ b/src/pm2tree.c
@@ -108,8 +108,8 @@ maketree2(int tree2bound) /* in use: 5 <= tree2bound <= 8 */
     else if (count > 1) {
         tree_rebuild(&tree2, tree2bound, 1, 7, table2);
     }
-    // Note: count == 0 is possible!
-    //       Excluding that possibility was a bug in version 1.
+    /* Note: count == 0 is possible!
+             Excluding that possibility was a bug in version 1. */
 
 }

This patch fixes the compilation:

mdec@Leela ~/git/lha $ make
make  all-recursive
make[1]: Wejście do katalogu '/home/mdec/git/lha'
Making all in man
make[2]: Wejście do katalogu '/home/mdec/git/lha/man'
make[2]: Nie ma nic do zrobienia w 'all'.
make[2]: Opuszczenie katalogu '/home/mdec/git/lha/man'
Making all in olddoc
make[2]: Wejście do katalogu '/home/mdec/git/lha/olddoc'
make[2]: Nie ma nic do zrobienia w 'all'.
make[2]: Opuszczenie katalogu '/home/mdec/git/lha/olddoc'
Making all in src
make[2]: Wejście do katalogu '/home/mdec/git/lha/src'
gcc -DHAVE_CONFIG_H -I. -I..  -DEUC -DSUPPORT_LH7   -O2 -g -std=c89 -MT append.o -MD -MP -MF .deps/append.Tpo -c -o append.o append.c
mv -f .deps/append.Tpo .deps/append.Po
gcc -DHAVE_CONFIG_H -I. -I..  -DEUC -DSUPPORT_LH7   -O2 -g -std=c89 -MT bitio.o -MD -MP -MF .deps/bitio.Tpo -c -o bitio.o bitio.c
mv -f .deps/bitio.Tpo .deps/bitio.Po
gcc -DHAVE_CONFIG_H -I. -I..  -DEUC -DSUPPORT_LH7   -O2 -g -std=c89 -MT crcio.o -MD -MP -MF .deps/crcio.Tpo -c -o crcio.o crcio.c
mv -f .deps/crcio.Tpo .deps/crcio.Po
gcc -DHAVE_CONFIG_H -I. -I..  -DEUC -DSUPPORT_LH7   -O2 -g -std=c89 -MT dhuf.o -MD -MP -MF .deps/dhuf.Tpo -c -o dhuf.o dhuf.c
mv -f .deps/dhuf.Tpo .deps/dhuf.Po
gcc -DHAVE_CONFIG_H -I. -I..  -DEUC -DSUPPORT_LH7   -O2 -g -std=c89 -MT extract.o -MD -MP -MF .deps/extract.Tpo -c -o extract.o extract.c
mv -f .deps/extract.Tpo .deps/extract.Po
gcc -DHAVE_CONFIG_H -I. -I..  -DEUC -DSUPPORT_LH7   -O2 -g -std=c89 -MT header.o -MD -MP -MF .deps/header.Tpo -c -o header.o header.c
header.c: In function ‘dump_get_byte’:
header.c:99:20: warning: format ‘%d’ expects argument of type ‘int’, but argument 2 has type ‘long int’ [-Wformat=]
   99 |         printf("%02d %2d: ", get_ptr - start_ptr, 1);
      |                 ~~~^         ~~~~~~~~~~~~~~~~~~~
      |                    |                 |
      |                    int               long int
      |                 %02ld
header.c: In function ‘dump_skip_bytes’:
header.c:116:20: warning: format ‘%d’ expects argument of type ‘int’, but argument 2 has type ‘long int’ [-Wformat=]
  116 |         printf("%02d %2d: ", get_ptr - start_ptr, len);
      |                 ~~~^         ~~~~~~~~~~~~~~~~~~~
      |                    |                 |
      |                    int               long int
      |                 %02ld
header.c: In function ‘get_word’:
header.c:138:20: warning: format ‘%d’ expects argument of type ‘int’, but argument 2 has type ‘long int’ [-Wformat=]
  138 |         printf("%02d %2d: ", get_ptr - start_ptr, 2);
      |                 ~~~^         ~~~~~~~~~~~~~~~~~~~
      |                    |                 |
      |                    int               long int
      |                 %02ld
header.c: In function ‘get_longword’:
header.c:166:20: warning: format ‘%d’ expects argument of type ‘int’, but argument 2 has type ‘long int’ [-Wformat=]
  166 |         printf("%02d %2d: ", get_ptr - start_ptr, 4);
      |                 ~~~^         ~~~~~~~~~~~~~~~~~~~
      |                    |                 |
      |                    int               long int
      |                 %02ld
header.c: In function ‘get_longlongword’:
header.c:198:20: warning: format ‘%d’ expects argument of type ‘int’, but argument 2 has type ‘long int’ [-Wformat=]
  198 |         printf("%02d %2d: ", get_ptr - start_ptr, 4);
      |                 ~~~^         ~~~~~~~~~~~~~~~~~~~
      |                    |                 |
      |                    int               long int
      |                 %02ld
header.c:214:20: warning: format ‘%lld’ expects argument of type ‘long long int’, but argument 2 has type ‘uint64_t’ {aka ‘long unsigned int’} [-Wformat=]
  214 |         printf("%lld(%#016llx)\n", l, l);
      |                 ~~~^               ~
      |                    |               |
      |                    long long int   uint64_t {aka long unsigned int}
      |                 %ld
header.c:214:29: warning: format ‘%llx’ expects argument of type ‘long long unsigned int’, but argument 3 has type ‘uint64_t’ {aka ‘long unsigned int’} [-Wformat=]
  214 |         printf("%lld(%#016llx)\n", l, l);
      |                      ~~~~~~~^         ~
      |                             |         |
      |                             |         uint64_t {aka long unsigned int}
      |                             long long unsigned int
      |                      %#016lx
header.c: In function ‘get_bytes’:
header.c:242:20: warning: format ‘%d’ expects argument of type ‘int’, but argument 2 has type ‘long int’ [-Wformat=]
  242 |         printf("%02d %2d: \"", get_ptr - start_ptr, len);
      |                 ~~~^           ~~~~~~~~~~~~~~~~~~~
      |                    |                   |
      |                    int                 long int
      |                 %02ld
header.c: In function ‘init_header’:
header.c:1570:9: warning: ignoring return value of ‘readlink’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
 1570 |         readlink(name, hdr->realname, sizeof(hdr->realname));
      |         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
mv -f .deps/header.Tpo .deps/header.Po
gcc -DHAVE_CONFIG_H -I. -I..  -DEUC -DSUPPORT_LH7   -O2 -g -std=c89 -MT huf.o -MD -MP -MF .deps/huf.Tpo -c -o huf.o huf.c
mv -f .deps/huf.Tpo .deps/huf.Po
gcc -DHAVE_CONFIG_H -I. -I..  -DEUC -DSUPPORT_LH7   -O2 -g -std=c89 -MT indicator.o -MD -MP -MF .deps/indicator.Tpo -c -o indicator.o indicator.c
mv -f .deps/indicator.Tpo .deps/indicator.Po
gcc -DHAVE_CONFIG_H -I. -I..  -DEUC -DSUPPORT_LH7   -O2 -g -std=c89 -MT larc.o -MD -MP -MF .deps/larc.Tpo -c -o larc.o larc.c
mv -f .deps/larc.Tpo .deps/larc.Po
gcc -DHAVE_CONFIG_H -I. -I..  -DEUC -DSUPPORT_LH7   -O2 -g -std=c89 -MT lhadd.o -MD -MP -MF .deps/lhadd.Tpo -c -o lhadd.o lhadd.c
lhadd.c: In function ‘set_archive_file_mode’:
lhadd.c:393:9: warning: ignoring return value of ‘chown’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
  393 |         chown(new_archive_name, getuid(), archive_file_gid);
      |         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
mv -f .deps/lhadd.Tpo .deps/lhadd.Po
gcc -DHAVE_CONFIG_H -I. -I..  -DEUC -DSUPPORT_LH7   -O2 -g -std=c89 -MT lharc.o -MD -MP -MF .deps/lharc.Tpo -c -o lharc.o lharc.c
lharc.c: In function ‘inquire’:
lharc.c:1439:9: warning: ignoring return value of ‘fgets’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
 1439 |         fgets(buffer, 1024, stdin);
      |         ^~~~~~~~~~~~~~~~~~~~~~~~~~
mv -f .deps/lharc.Tpo .deps/lharc.Po
gcc -DHAVE_CONFIG_H -I. -I..  -DEUC -DSUPPORT_LH7   -O2 -g -std=c89 -MT lhext.o -MD -MP -MF .deps/lhext.Tpo -c -o lhext.o lhext.c
lhext.c: In function ‘adjust_info’:
lhext.c:267:17: warning: ignoring return value of ‘lchown’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
  267 |                 lchown(name, uid, gid);
      |                 ^~~~~~~~~~~~~~~~~~~~~~
lhext.c:270:17: warning: ignoring return value of ‘chown’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
  270 |                 chown(name, uid, gid);
      |                 ^~~~~~~~~~~~~~~~~~~~~
mv -f .deps/lhext.Tpo .deps/lhext.Po
gcc -DHAVE_CONFIG_H -I. -I..  -DEUC -DSUPPORT_LH7   -O2 -g -std=c89 -MT lhlist.o -MD -MP -MF .deps/lhlist.Tpo -c -o lhlist.o lhlist.c
lhlist.c: In function ‘print_size’:
lhlist.c:26:21: warning: format ‘%llu’ expects argument of type ‘long long unsigned int’, but argument 2 has type ‘off_t’ {aka ‘long int’} [-Wformat=]
   26 |         printf("%7llu ", packed_size);
      |                 ~~~~^    ~~~~~~~~~~~
      |                     |    |
      |                     |    off_t {aka long int}
      |                     long long unsigned int
      |                 %7lu
lhlist.c:28:17: warning: format ‘%llu’ expects argument of type ‘long long unsigned int’, but argument 2 has type ‘off_t’ {aka ‘long int’} [-Wformat=]
   28 |     printf("%7llu ", original_size);
      |             ~~~~^    ~~~~~~~~~~~~~
      |                 |    |
      |                 |    off_t {aka long int}
      |                 long long unsigned int
      |             %7lu
mv -f .deps/lhlist.Tpo .deps/lhlist.Po
gcc -DHAVE_CONFIG_H -I. -I..  -DEUC -DSUPPORT_LH7   -O2 -g -std=c89 -MT maketbl.o -MD -MP -MF .deps/maketbl.Tpo -c -o maketbl.o maketbl.c
mv -f .deps/maketbl.Tpo .deps/maketbl.Po
gcc -DHAVE_CONFIG_H -I. -I..  -DEUC -DSUPPORT_LH7   -O2 -g -std=c89 -MT maketree.o -MD -MP -MF .deps/maketree.Tpo -c -o maketree.o maketree.c
mv -f .deps/maketree.Tpo .deps/maketree.Po
gcc -DHAVE_CONFIG_H -I. -I..  -DEUC -DSUPPORT_LH7   -O2 -g -std=c89 -MT patmatch.o -MD -MP -MF .deps/patmatch.Tpo -c -o patmatch.o patmatch.c
mv -f .deps/patmatch.Tpo .deps/patmatch.Po
gcc -DHAVE_CONFIG_H -I. -I..  -DEUC -DSUPPORT_LH7   -O2 -g -std=c89 -MT shuf.o -MD -MP -MF .deps/shuf.Tpo -c -o shuf.o shuf.c
mv -f .deps/shuf.Tpo .deps/shuf.Po
gcc -DHAVE_CONFIG_H -I. -I..  -DEUC -DSUPPORT_LH7   -O2 -g -std=c89 -MT slide.o -MD -MP -MF .deps/slide.Tpo -c -o slide.o slide.c
slide.c: In function ‘decode’:
slide.c:442:30: warning: format ‘%llu’ expects argument of type ‘long long unsigned int’, but argument 2 has type ‘off_t’ {aka ‘long int’} [-Wformat=]
  442 |                 printf("%04llu %02x(%c)\n",
      |                         ~~~~~^
      |                              |
      |                              long long unsigned int
      |                         %04lu
  443 |                        decode_count, c, isprint(c) ? c : '?');
      |                        ~~~~~~~~~~~~
      |                        |
      |                        off_t {aka long int}
slide.c:465:30: warning: format ‘%llu’ expects argument of type ‘long long unsigned int’, but argument 2 has type ‘off_t’ {aka ‘long int’} [-Wformat=]
  465 |                 printf("%04llu <%u %llu>\n",
      |                         ~~~~~^
      |                              |
      |                              long long unsigned int
      |                         %04lu
  466 |                        decode_count, match.len, decode_count-match.off);
      |                        ~~~~~~~~~~~~
      |                        |
      |                        off_t {aka long int}
slide.c:465:39: warning: format ‘%llu’ expects argument of type ‘long long unsigned int’, but argument 4 has type ‘off_t’ {aka ‘long int’} [-Wformat=]
  465 |                 printf("%04llu <%u %llu>\n",
      |                                    ~~~^
      |                                       |
      |                                       long long unsigned int
      |                                    %lu
  466 |                        decode_count, match.len, decode_count-match.off);
      |                                                 ~~~~~~~~~~~~~~~~~~~~~~
      |                                                             |
      |                                                             off_t {aka long int}
mv -f .deps/slide.Tpo .deps/slide.Po
gcc -DHAVE_CONFIG_H -I. -I..  -DEUC -DSUPPORT_LH7   -O2 -g -std=c89 -MT util.o -MD -MP -MF .deps/util.Tpo -c -o util.o util.c
mv -f .deps/util.Tpo .deps/util.Po
gcc -DHAVE_CONFIG_H -I. -I..  -DEUC -DSUPPORT_LH7   -O2 -g -std=c89 -MT getopt_long.o -MD -MP -MF .deps/getopt_long.Tpo -c -o getopt_long.o getopt_long.c
mv -f .deps/getopt_long.Tpo .deps/getopt_long.Po
gcc -DHAVE_CONFIG_H -I. -I..  -DEUC -DSUPPORT_LH7   -O2 -g -std=c89 -MT pm2.o -MD -MP -MF .deps/pm2.Tpo -c -o pm2.o pm2.c
mv -f .deps/pm2.Tpo .deps/pm2.Po
gcc -DHAVE_CONFIG_H -I. -I..  -DEUC -DSUPPORT_LH7   -O2 -g -std=c89 -MT pm2hist.o -MD -MP -MF .deps/pm2hist.Tpo -c -o pm2hist.o pm2hist.c
mv -f .deps/pm2hist.Tpo .deps/pm2hist.Po
gcc -DHAVE_CONFIG_H -I. -I..  -DEUC -DSUPPORT_LH7   -O2 -g -std=c89 -MT pm2tree.o -MD -MP -MF .deps/pm2tree.Tpo -c -o pm2tree.o pm2tree.c
mv -f .deps/pm2tree.Tpo .deps/pm2tree.Po
gcc -DHAVE_CONFIG_H -I. -I..  -DEUC -DSUPPORT_LH7   -O2 -g -std=c89 -MT support_utf8.o -MD -MP -MF .deps/support_utf8.Tpo -c -o support_utf8.o support_utf8.c
mv -f .deps/support_utf8.Tpo .deps/support_utf8.Po
gcc  -O2 -g -std=c89   -o lha append.o bitio.o crcio.o dhuf.o extract.o header.o huf.o indicator.o larc.o lhadd.o lharc.o lhext.o lhlist.o maketbl.o maketree.o patmatch.o shuf.o slide.o util.o getopt_long.o pm2.o pm2hist.o pm2tree.o support_utf8.o  
make[2]: Opuszczenie katalogu '/home/mdec/git/lha/src'
Making all in tests
make[2]: Wejście do katalogu '/home/mdec/git/lha/tests'
make[2]: Nie ma nic do zrobienia w 'all'.
make[2]: Opuszczenie katalogu '/home/mdec/git/lha/tests'
make[2]: Wejście do katalogu '/home/mdec/git/lha'
make[2]: Opuszczenie katalogu '/home/mdec/git/lha'
make[1]: Opuszczenie katalogu '/home/mdec/git/lha'

Unit test results:

mdec@Leela ~/git/lha $ make check
Making check in man
make[1]: Wejście do katalogu '/home/mdec/git/lha/man'
make[1]: Nie ma nic do zrobienia w 'check'.
make[1]: Opuszczenie katalogu '/home/mdec/git/lha/man'
Making check in olddoc
make[1]: Wejście do katalogu '/home/mdec/git/lha/olddoc'
make[1]: Nie ma nic do zrobienia w 'check'.
make[1]: Opuszczenie katalogu '/home/mdec/git/lha/olddoc'
Making check in src
make[1]: Wejście do katalogu '/home/mdec/git/lha/src'
make[1]: Nie ma nic do zrobienia w 'check'.
make[1]: Opuszczenie katalogu '/home/mdec/git/lha/src'
Making check in tests
make[1]: Wejście do katalogu '/home/mdec/git/lha/tests'
make  lha-test
make[2]: Wejście do katalogu '/home/mdec/git/lha/tests'
make[2]: 'lha-test' jest aktualne.
make[2]: Opuszczenie katalogu '/home/mdec/git/lha/tests'
make  check-local
make[2]: Wejście do katalogu '/home/mdec/git/lha/tests'
bash ./lha-test
testing /home/mdec/git/lha/src/lha
LHa for UNIX version 1.14i-ac20220213 (x86_64-pc-linux-gnu) configure options: 'CFLAGS=-O2 -g -std=c89'
testing to create/list/extract lha archive.
lha-test1 #1 ... ok
lha-test1 #2 ... ok
lha-test1 #3 ... ok
lha-test1 #4 ... ok
lha-test1 #5 ... ok
lha-test1 #6 ... ok
lha-test1 #7 ... ok
lha-test1 #8 ... ok
lha-test1 #9 ... ok
testing to lh0, lh1, lh5, lh6 and lh7 method archive.
lha-test2 #1 ... ok
lha-test2 #2 ... ok
lha-test2 #3 ... ok
lha-test2 #4 ... ok
lha-test2 #5 ... ok
lha-test2 #6 ... ok
lha-test2 #7 ... ok
lha-test2 #8 ... ok
lha-test2 #9 ... ok
lha-test2 #10 ... ok
lha-test2 #11 ... ok
lha-test2 #12 ... ok
lha-test2 #13 ... ok
lha-test2 #14 ... ok
lha-test2 #15 ... ok
lha-test2 #16 ... ok
lha-test2 #17 ... ok
lha-test2 #18 ... ok
lha-test2 #19 ... ok
lha-test2 #20 ... ok
lha-test2 #21 ... ok
lha-test2 #22 ... ok
lha-test2 #23 ... ok
lha-test2 #24 ... ok
lha-test2 #25 ... ok
lha-test2 #26 ... ok
lha-test2 #27 ... ok
lha-test2 #28 ... ok
lha-test2 #29 ... ok
lha-test2 #30 ... ok
lha-test2 #31 ... ok
lha-test2 #32 ... ok
lha-test2 #33 ... ok
lha-test2 #34 ... ok
lha-test2 #35 ... ok
lha-test2 #36 ... ok
lha-test2 #37 ... ok
lha-test2 #38 ... ok
lha-test2 #39 ... ok
testing to generic format archive.
lha-test3 #1 ... ok
lha-test3 #2 ... ok
lha-test3 #3 ... ok
lha-test3 #4 ... ok
lha-test3 #5 ... ok
lha-test3 #6 ... ok
lha-test3 #7 ... ok
lha-test3 #8 ... ok
lha-test3 #9 ... ok
lha-test3 #10 ... ok
lha-test3 #11 ... ok
lha-test3 #12 ... ok
lha-test3 #13 ... ok
lha-test3 #14 ... ok
lha-test3 #15 ... ok
lha-test3 #16 ... ok
lha-test3 #17 ... ok
lha-test3 #18 ... ok
lha-test3 #19 ... ok
lha-test3 #20 ... ok
lha-test3 #21 ... ok
lha-test3 #22 ... ok
lha-test3 #23 ... ok
lha-test3 #24 ... ok
lha-test3 #25 ... ok
lha-test3 #26 ... ok
lha-test3 #27 ... ok
lha-test3 #28 ... ok
lha-test3 #29 ... ok
lha-test3 #30 ... ok
lha-test3 #31 ... ok
testing to delete files from archive.
lha-test4 #1 ... ok
lha-test4 #2 ... ok
lha-test4 #3 ... ok
lha-test4 #4 ... ok
lha-test4 #5 ... ok
lha-test4 #6 ... ok
lha-test4 #7 ... ok
lha-test4 #8 ... ok
lha-test4 #9 ... ok
lha-test4 #10 ... ok
lha-test4 #11 ... ok
lha-test4 #12 ... ok
lha-test4 #13 ... ok
testing to treat stdin/stdout as archive file.
lha-test5 #1 ... ok
lha-test5 #2 ... ok
lha-test5 #3 ... ok
lha-test5 #4 ... ok
lha-test5 #5 ... ok
lha-test5 #6 ... ok
lha-test5 #7 ... ok
lha-test5 #8 ... ok
lha-test5 #9 ... ok
testing to add/update files to archive.
lha-test7 #1 ... ok
lha-test7 #2 ... ok
lha-test7 #3 ... ok
lha-test7 #4 ... ok
lha-test7 #5 ... ok
lha-test7 #6 ... ok
lha-test7 #7 ... ok
lha-test7 #8 ... ok
lha-test7 #9 ... ok
lha-test7 #10 ... ok
lha-test7 #11 ... ok
lha-test7 #12 ... ok
lha-test7 #13 ... ok
lha-test7 #14 ... ok
lha-test7 #15 ... ok
lha-test7 #16 ... ok
lha-test7 #17 ... ok
lha-test7 #18 ... ok
testing to add/update files to archive.
lha-test7_lv0 #1 ... ok
lha-test7_lv0 #2 ... ok
lha-test7_lv0 #3 ... ok
lha-test7_lv0 #4 ... ok
lha-test7_lv0 #5 ... ok
lha-test7_lv0 #6 ... ok
lha-test7_lv0 #7 ... ok
lha-test7_lv0 #8 ... ok
lha-test7_lv0 #9 ... ok
lha-test7_lv0 #10 ... ok
lha-test7_lv0 #11 ... ok
lha-test7_lv0 #12 ... ok
lha-test7_lv0 #13 ... ok
lha-test7_lv0 #14 ... ok
lha-test7_lv0 #15 ... ok
lha-test7_lv0 #16 ... ok
lha-test7_lv0 #17 ... ok
lha-test7_lv0 #18 ... ok
testing to add/update files to archive.
lha-test7_lv1 #1 ... ok
lha-test7_lv1 #2 ... ok
lha-test7_lv1 #3 ... ok
lha-test7_lv1 #4 ... ok
lha-test7_lv1 #5 ... ok
lha-test7_lv1 #6 ... ok
lha-test7_lv1 #7 ... ok
lha-test7_lv1 #8 ... ok
lha-test7_lv1 #9 ... ok
lha-test7_lv1 #10 ... ok
lha-test7_lv1 #11 ... ok
lha-test7_lv1 #12 ... ok
lha-test7_lv1 #13 ... ok
lha-test7_lv1 #14 ... ok
lha-test7_lv1 #15 ... ok
lha-test7_lv1 #16 ... ok
lha-test7_lv1 #17 ... ok
lha-test7_lv1 #18 ... ok
testing to add/update files to archive.
lha-test7_lvg #1 ... ok
lha-test7_lvg #2 ... ok
lha-test7_lvg #3 ... ok
lha-test7_lvg #4 ... ok
lha-test7_lvg #5 ... ok
lha-test7_lvg #6 ... ok
lha-test7_lvg #7 ... ok
lha-test7_lvg #8 ... ok
lha-test7_lvg #9 ... ok
lha-test7_lvg #10 ... ok
lha-test7_lvg #11 ... ok
lha-test7_lvg #12 ... ok
lha-test7_lvg #13 ... ok
lha-test7_lvg #14 ... ok
lha-test7_lvg #15 ... ok
lha-test7_lvg #16 ... ok
lha-test7_lvg #17 ... ok
lha-test7_lvg #18 ... ok
testing timestamp
lha-test8 #1 ... ok
lha-test8 #2 ... ok
lha-test8 #3 ... ok
lha-test8 #4 ... ok
lha-test8 #5 ... ok
lha-test8 #6 ... ok
lha-test8 #7 ... ok
lha-test8 #8 ... ok
lha-test8 #9 ... ok
lha-test8 #10 ... ok
lha-test8 #11 ... ok
lha-test8 #12 ... ok
lha-test8 #13 ... ok
lha-test8 #14 ... ok
lha-test8 #15 ... ok
lha-test8 #16 ... ok
lha-test8 #17 ... ok
lha-test8 #18 ... ok
lha-test8 #19 ... ok
lha-test8 #20 ... ok
lha-test8 #21 ... ok
testing header level 0, 1, 2 and each generic headers
lha-test10 #1 ... ok
lha-test10 #2 ... ok
lha-test10 #3 ... ok
lha-test10 #4 ... ok
lha-test10 #5 ... ok
lha-test10 #6 ... ok
lha-test10 #7 ... ok
lha-test10 #8 ... ok
lha-test10 #9 ... ok
lha-test10 #10 ... ok
lha-test10 #11 ... ok
lha-test10 #12 ... ok
lha-test10 #13 ... ok
lha-test10 #14 ... ok
lha-test10 #15 ... ok
lha-test10 #16 ... ok
lha-test10 #17 ... ok
lha-test10 #18 ... ok
lha-test10 #19 ... ok
lha-test10 #20 ... ok
lha-test10 #21 ... ok
lha-test10 #22 ... ok
lha-test10 #23 ... ok
lha-test10 #24 ... ok
lha-test10 #25 ... ok
lha-test10 #26 ... ok
lha-test10 #27 ... ok
lha-test10 #28 ... ok
lha-test10 #29 ... ok
lha-test10 #30 ... ok
lha-test10 #31 ... ok
lha-test10 #32 ... ok
lha-test10 #33 ... ok
lha-test10 #34 ... ok
lha-test10 #35 ... ok
lha-test10 #36 ... ok
lha-test10 #37 ... ok
lha-test10 #38 ... ok
lha-test10 #39 ... ok
lha-test10 #40 ... ok
lha-test10 #41 ... ok
lha-test10 #42 ... ok
lha-test10 #43 ... ok
lha-test10 #44 ... ok
lha-test10 #45 ... ok
lha-test10 #46 ... ok
lha-test10 #47 ... ok
lha-test10 #48 ... ok
lha-test10 #49 ... ok
lha-test10 #50 ... ok
lha-test10 #51 ... ok
lha-test10 #52 ... ok
lha-test10 #53 ... ok
lha-test10 #54 ... ok
lha-test10 #55 ... ok
lha-test10 #56 ... ok
lha-test10 #57 ... ok
lha-test10 #58 ... ok
lha-test10 #59 ... ok
lha-test10 #60 ... ok
lha-test10 #61 ... ok
lha-test10 #62 ... ok
lha-test10 #63 ... ok
lha-test10 #64 ... ok
lha-test10 #65 ... ok
lha-test10 #66 ... ok
lha-test10 #67 ... ok
lha-test10 #68 ... ok
lha-test10 #69 ... ok
lha-test10 #70 ... ok
lha-test10 #71 ... ok
lha-test10 #72 ... ok
lha-test10 #73 ... ok
lha-test10 #74 ... ok
testing the long filename support
lha-test11 #1 ... ok
lha-test11 #2 ... ok
lha-test11 #3 ... ok
lha-test11 #4 ... ok
lha-test11 #5 ... ok
lha-test11 #6 ... ok
lha-test11 #7 ... ok
lha-test11 #8 ... ok
lha-test11 #9 ... ok
lha-test11 #10 ... ok
lha-test11 #11 ... ok
lha-test11 #12 ... ok
lha-test11 #13 ... ok
lha-test11 #14 ... ok
lha-test11 #15 ... ok
lha-test11 #16 ... ok
lha-test11 #17 ... ok
lha-test11 #18 ... ok
lha-test11 #19 ... ok
lha-test11 #20 ... ok
lha-test11 #21 ... ok
lha-test11 #22 ... ok
lha-test11 #23 ... ok
lha-test11 #24 ... ok
lha-test11 #25 ... ok
lha-test11 #26 ... ok
lha-test11 #27 ... ok
lha-test11 #28 ... ok
lha-test11 #29 ... ok
lha-test11 #30 ... ok
testing the end of line conversion.
lha-test12 #1 ... ok
lha-test12 #2 ... ok
lha-test12 #3 ... ok
lha-test12 #4 ... ok
lha-test12 #5 ... ok
lha-test12 #6 ... ok
lha-test12 #7 ... ok
lha-test12 #8 ... ok
lha-test12 #9 ... ok
lha-test12 #10 ... ok
lha-test12 #11 ... ok
testing the kanji code conversion.
Linux
lha-test13 #1 ... ok
lha-test13 #2 ... ok
lha-test13 #3 ... ok
lha-test13 #4 ... ok
lha-test13 #5 ... ok
lha-test13 #6 ... ok
lha-test13 #7 ... ok
lha-test13 #8 ... ok
lha-test13 #9 ... ok
lha-test13 #10 ... ok
lha-test13 #11 ... ok
lha-test13 #12 ... ok
lha-test13 #13 ... ok
lha-test13 #14 ... ok
lha-test13 #15 ... ok
lha-test13 #16 ... ok
lha-test13 #17 ... ok
lha-test13 #18 ... ok
lha-test13 #19 ... ok
lha-test13 #20 ... ok
lha-test13 #21 ... ok
lha-test13 #22 ... ok
lha-test13 #23 ... ok
lha-test13 #24 ... ok
lha-test13 #25 ... ok
lha-test13 #26 ... ok
lha-test13 #27 ... ok
lha-test13 #28 ... ok
testing to handle symbolic links
lha-test14 #1 ... ok
lha-test14 #2 ... ok
lha-test14 #3 ... ok
lha-test14 #4 ... ok
lha-test14 #5 ... ok
lha-test14 #6 ... ok
lha-test14 #7 ... ok
lha-test14 #8 ... ok
lha-test14 #9 ... ok
lha-test14 #10 ... ok
lha-test14 #11 ... ok
lha-test14 #12 ... ok
lha-test14 #13 ... ok
lha-test14 #14 ... ok
lha-test14 #15 ... ok
lha-test14 #16 ... ok
lha-test14 #17 ... ok
lha-test14 #18 ... ok
lha-test14 #19 ... ok
lha-test14 #20 ... ok
lha-test14 #21 ... ok
lha-test14 #22 ... ok
testing to self extracting archive
lha-test15 #1 ... ok
lha-test15 #2 ... ok
lha-test15 #3 ... ok
lha-test15 #4 ... ok
lha-test15 #5 ... ok
lha-test15 #6 ... ok
lha-test15 #7 ... ok
lha-test15 #8 ... ok
lha-test15 #9 ... ok
lha-test15 #10 ... ok
lha-test15 #11 ... ok
lha-test15 #12 ... ok
lha-test15 #13 ... ok
lha-test15 #14 ... ok
lha-test15 #15 ... ok
lha-test15 #16 ... ok
lha-test15 #17 ... ok
lha-test15 #18 ... ok
testing the header CRC
lha-test16 #1 ... ok
lha-test16 #2 ... ok
lha-test16 #3 ... ok
lha-test16 #4 ... ok
testing to remove relative path
lha-test17 #1 ... ok
lha-test17 #2 ... ok
lha-test17 #3 ... ok
lha-test17 #4 ... ok
lha-test17 #5 ... ok
lha-test17 #6 ... ok
lha-test17 #7 ... ok
lha-test17 #8 ... ok
lha-test17 #9 ... ok
lha-test17 #10 ... ok
lha-test17 #11 ... ok
lha-test17 #12 ... ok
lha-test17 #13 ... ok
lha-test17 #14 ... ok
lha-test17 #15 ... ok
lha-test17 #16 ... ok
lha-test17 #17 ... ok
lha-test17 #18 ... ok
lha-test17 #19 ... ok
lha-test17 #20 ... ok
lha-test17 #21 ... ok
lha-test17 #22 ... ok
lha-test17 #23 ... ok
lha-test17 #24 ... ok
lha-test17 #25 ... ok
lha-test17 #26 ... ok
lha-test17 #27 ... ok
lha-test17 #28 ... ok
lha-test17 #29 ... ok
lha-test17 #30 ... ok
lha-test17 #31 ... ok
lha-test17 #32 ... ok
lha-test17 #33 ... ok
lha-test17 #34 ... ok
restore directory permission
lha-test18 #1 ... ok
lha-test18 #2 ... ok
lha-test18 #3 ... ok
lha-test18 #4 ... ok
lha-test18 #5 ... ok
lha-test18 #6 ... ok
lha-test18 #7 ... ok
lha-test18 #8 ... ok
lha-test18 #9 ... ok
lha-test18 #10 ... ok
lha-test18 #11 ... ok
lha-test18 #12 ... ok
lha-test18 #13 ... ok
lha-test18 #14 ... ok
lha-test18 #15 ... ok
lha-test18 #16 ... ok
lha-test18 #17 ... ok
lha-test18 #18 ... ok
lha-test18 #19 ... ok
lha-test18 #20 ... ok
lha-test18 #21 ... ok
archive timestamping
lha-test19 #1 ... ok
lha-test19 #2 ... ok
lha-test19 #3 ... ok
lha-test19 #4 ... ok
lha-test19 #5 ... ok
lha-test19 #6 ... ok
lha-test19 #7 ... ok
lha-test19 #8 ... ok
lha-test19 #9 ... ok
lha-test19 #10 ... ok
lha-test19 #11 ... ok
lha-test19 #12 ... ok
lha-test19 #13 ... ok
lha-test19 #14 ... ok
lha-test19 #15 ... ok
lha-test19 #16 ... ok
lha-test19 #17 ... ok
lha-test19 #18 ... ok
lha-test19 #19 ... ok
testing japanese filename conversion
lha-test20 #1 ... ok
lha-test20 #2 ... ok
lha-test20 #3 ... ok
lha-test20 #4 ... ok
lha-test20 #5 ... ok
lha-test20 #6 ... ok
lha-test20 #7 ... ok
lha-test20 #8 ... ok
lha-test20 #9 ... ok
lha-test20 #10 ... ok
lha-test20 #11 ... ok
lha-test20 #12 ... ok
lha-test20 #13 ... ok
lha-test20 #14 ... ok
lha-test20 #15 ... ok
lha-test20 #16 ... ok
lha-test20 #17 ... ok
lha-test20 #18 ... ok
lha-test20 #19 ... ok
lha-test20 #20 ... ok
lha-test20 #21 ... ok
lha-test20 #22 ... ok
lha-test20 #23 ... ok
lha-test20 #24 ... ok
lha-test20 #25 ... ok
lha-test20 #26 ... ok
lha-test20 #27 ... ok
lha-test20 #28 ... ok
lha-test20 #29 ... ok
lha-test20 #30 ... ok
lha-test20 #31 ... ok
lha-test20 #32 ... ok
lha-test20 #33 ... ok
lha-test20 #34 ... ok
lha-test20 #35 ... ok
lha-test20 #36 ... ok
lha-test20 #37 ... ok
lha-test20 #38 ... ok
lha-test20 #39 ... ok
lha-test20 #40 ... ok
lha-test20 #41 ... ok
lha-test20 #42 ... ok
lha-test20 #43 ... ok
lha-test20 #44 ... ok
lha-test20 #45 ... ok
lha-test20 #46 ... ok
lha-test20 #47 ... ok
lha-test20 #48 ... ok
lha-test20 #49 ... ok
lha-test20 #50 ... ok
lha-test20 #51 ... ok
lha-test20 #52 ... ok
lha-test20 #53 ... ok
lha-test20 #54 ... ok
lha-test20 #55 ... ok
lha-test20 #56 ... ok
lha-test20 #57 ... ok
lha-test20 #58 ... ok
lha-test20 #59 ... ok
lha-test20 #60 ... ok
lha-test20 #61 ... ok
lha-test20 #62 ... ok
lha-test20 #63 ... ok
lha-test20 #64 ... ok
All tests succeeded.
make[2]: Opuszczenie katalogu '/home/mdec/git/lha/tests'
make[1]: Opuszczenie katalogu '/home/mdec/git/lha/tests'
make[1]: Wejście do katalogu '/home/mdec/git/lha'
make[1]: Opuszczenie katalogu '/home/mdec/git/lha'

grepwood avatar May 05 '24 14:05 grepwood

@grepwood Well, try to use an old gcc2. I didn't make the patch, maybe MacPorts wants to support old compilers.

polluks avatar May 05 '24 22:05 polluks

K&Rスタイルでは変数宣言はブロックの先頭に書かなくてはならないとされており、今のコードは文法違反ですから、修正した方が良いと考えます。実際、修正前のソースをgcc-2.95.2 (Mac OS X 10.2)でコンパイルすると以下のエラーが出ました。

gcc2 -DHAVE_CONFIG_H -I. -I. -I..  -DEUC -DSUPPORT_LH7   -g -O2 -c `test -f 'bitio.c' || echo './'`bitio.c
bitio.c: In function `fillbuf':
bitio.c:23: parse error before `int'
bitio.c:24: `c' undeclared (first use in this function)
bitio.c:24: (Each undeclared identifier is reported only once
bitio.c:24: for each function it appears in.)
make[2]: *** [bitio.o] Error 1

修正方法ですがPRは処理順序を変えているのが気になりました。下記を提案します。

diff -c bitio.c.org bitio.c
*** bitio.c.org	Sun Feb 27 15:46:04 2022
--- bitio.c	Tue Sep 23 14:40:59 2025
***************
*** 19,26 ****
          n -= bitcount;
          bitbuf = (bitbuf << bitcount) + (subbitbuf >> (CHAR_BIT - bitcount));
          if (compsize != 0) {
              compsize--;
!             int c = getc(infile);
              if (c == EOF) {
                  fatal_error("cannot read stream");
              }
--- 19,27 ----
          n -= bitcount;
          bitbuf = (bitbuf << bitcount) + (subbitbuf >> (CHAR_BIT - bitcount));
          if (compsize != 0) {
+             int c;
              compsize--;
!             c = getc(infile);
              if (c == EOF) {
                  fatal_error("cannot read stream");
              }

hirotosakai avatar Sep 23 '25 05:09 hirotosakai

I see, I finally understand the meaning of the original pull request proposal. I’ll go ahead and adopt the original patch as it is. Thank you for letting me know.

jca02266 avatar Sep 23 '25 22:09 jca02266