Code Monkey home page Code Monkey logo

compress-raw-bzip2's People

Contributors

afresh1 avatar atoomic avatar demerphq avatar ilmari avatar pmqs avatar

Stargazers

 avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

compress-raw-bzip2's Issues

register keyword removed from C++17

As you know we build blead perl using C++, but some modern C++ compilers that default to C++17 report an error for the register keyword:

 c++ -DNO_MATHOMS -I/usr/local/include -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -Wall -Werror=pointer-arith -Werror=vla -Wextra -Wno-long-long -Wno-declaration-after-statement -Wc++-compat -Wwrite-strings -O2   -DVERSION=\"2.204\" -DXS_VERSION=\"2.204\" -fPIC "-I../.."  -DBZ_NO_STDIO  compress.c
compress.c:190:13: error: ISO C++17 does not allow 'register' storage class specifier [-Wregister]
            register UChar  rtmp;
            ^~~~~~~~~

This can be fixed by simply removing "register" and if you like I can supply a PR doing that, but that will also increase the distance between your bzip source and the upstream bzip source, you might prefer to add:

#define register

at the top instead.

Build produces uninitialized warnings in bleadperl

When building inside of bleadperl (5.35) we see the following warnings.

gcc -c  -I. -D_REENTRANT -D_GNU_SOURCE -fwrapv -fno-strict-aliasing -pipe -fstack-protector-strong -I/usr/local/include -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -Wall -Werror=pointer-arith -Werror=vla -Wextra -Wno-long-long -Wno-declaration-after-statement -Wc++-compat -Wwrite-strings -O3   -DVERSION=\"2.101\" -DXS_VERSION=\"2.101\" -fPIC "-I../.."  -Wall -Wno-comment  -DBZ_NO_STDIO  compress.c
compress.c: In function ‘BZ2_compressBlock’:
compress.c:392:54: warning: ‘cost[5]’ may be used uninitialized in this function [-Wmaybe-uninitialized]
                for (t = 0; t < nGroups; t++) cost[t] += s->len[t][icv];
                                                      ^~
compress.c:256:11: note: ‘cost[5]’ was declared here
    UInt16 cost[BZ_N_GROUPS];
           ^~~~
compress.c:402:21: warning: ‘cost[3]’ may be used uninitialized in this function [-Wmaybe-uninitialized]
             if (cost[t] < bc) { bc = cost[t]; bt = t; };
                 ~~~~^~~
compress.c:256:11: note: ‘cost[3]’ was declared here
    UInt16 cost[BZ_N_GROUPS];
           ^~~~
compress.c:402:21: warning: ‘cost[2]’ may be used uninitialized in this function [-Wmaybe-uninitialized]
             if (cost[t] < bc) { bc = cost[t]; bt = t; };
                 ~~~~^~~
compress.c:256:11: note: ‘cost[2]’ was declared here
    UInt16 cost[BZ_N_GROUPS];
           ^~~~

change in build behaviour from 2.207

before 5c062e7 the default was to build the embedded bzip2 library

after that commit, the default is to not build it

therefore, machines that don't have a bzlib.h header already present (and the accompanying library), can't build this distribution anymore

was that change intentional? the README seems to imply it was an accident, and maybe getBoolean should return 1 when the env variable is not present

Unreached code, and bzip2.patch out of date.

On HPUX this module throws build warnings:

"bzlib.c", line 862: warning #2111-D: statement is unreachable
     AssertH ( 0, 6001 );
"compress.c", line 261: warning #2549-D: variable "nBytes" is used before its
          value is set
     ((void)nBytes); /* Silence variable ‘nBytes’ set but not used warning */

Reviewing the code both are correct.

For the bzlib.c case the function BZ2_bzDecompress has a while(1) look with no breaks inside, all exits from the loop are via a return statement. Presumably the AssertH() is there to detect if somehow that changes, but for a picky compiler it throws warnings.

For the compress.c case the functions reads from nBytes before it is set.

$ git diff
diff --git a/bzip2-src/bzlib.c b/bzip2-src/bzlib.c
index 88118bf..e870307 100644
--- a/bzip2-src/bzlib.c
+++ b/bzip2-src/bzlib.c
@@ -859,9 +859,7 @@ int BZ_API(BZ2_bzDecompress) ( bz_stream *strm )
       }
    }
 
-   AssertH ( 0, 6001 );
-
-   return 0;  /*NOTREACHED*/
+   /*NOTREACHED*/
 }
 
 
diff --git a/bzip2-src/compress.c b/bzip2-src/compress.c
index 99cd709..a43ec65 100644
--- a/bzip2-src/compress.c
+++ b/bzip2-src/compress.c
@@ -240,7 +240,8 @@ void sendMTFValues ( EState* s )
 {
    Int32 v, t, i, j, gs, ge, totc, bt, bc, iter;
    Int32 nSelectors, alphaSize, minLen, maxLen, selCtr;
-   Int32 nGroups, nBytes;
+   Int32 nGroups;
+   Int32 nBytes = 0;
 
    /*--
    UChar  len [BZ_N_GROUPS][BZ_MAX_ALPHA_SIZE];

I wanted to apply these two patches, and the send you the diff along with an updated bzip2.patch file as well, but i cannot apply the bzip2.patch file to reverse out the existing changes. It looks like the bzip2.patch file was produced a long time ago, and since then various updates have been made to the distributed code without updating the patch file. Also two of the files the .patch file references aren't in the distributed code.

$ patch -R -p1 < bzip2.patch 
can't find file to patch at input line 5
Perhaps you used the wrong -p or --strip option?
The text leading up to this was:
--------------------------
|diff --git a/bzip2.c b/bzip2.c
|index d95d280..7852cc4 100644
|--- a/bzip2.c
|+++ b/bzip2.c
--------------------------
File to patch: 
Skip this patch? [y] 
Skipping patch.
1 out of 1 hunk ignored
can't find file to patch at input line 22
Perhaps you used the wrong -p or --strip option?
The text leading up to this was:
--------------------------
|diff --git a/bzip2recover.c b/bzip2recover.c
|index a8131e0..0925048 100644
|--- a/bzip2recover.c
|+++ b/bzip2recover.c
--------------------------
File to patch: 
Skip this patch? [y] 
Skipping patch.
2 out of 2 hunks ignored
patching file bzlib.c
Hunk #1 succeeded at 169 (offset 4 lines).
Hunk #2 succeeded at 178 (offset 4 lines).
Hunk #3 FAILED at 362.
Hunk #4 succeeded at 413 (offset 4 lines).
Hunk #5 succeeded at 473 (offset 4 lines).
Hunk #6 succeeded at 509 (offset 4 lines).
Hunk #7 succeeded at 688 (offset 4 lines).
Hunk #8 succeeded at 814 (offset 4 lines).
Hunk #9 succeeded at 867 (offset 4 lines).
Hunk #10 succeeded at 938 (offset 4 lines).
Hunk #11 succeeded at 986 (offset 4 lines).
Hunk #12 FAILED at 1107.
Hunk #13 succeeded at 1183 (offset 4 lines).
2 out of 13 hunks FAILED -- saving rejects to file bzlib.c.rej
patching file bzlib_private.h
patching file crctable.c
patching file decompress.c
Hunk #1 FAILED at 209.
1 out of 1 hunk FAILED -- saving rejects to file decompress.c.rej
patching file randtable.c
Hunk #1 FAILED at 23.
1 out of 1 hunk FAILED -- saving rejects to file randtable.c.rej

Please let me know what i can do to tell help you help me silence the HPUX warnings. I am on a warpath to get perl to build warning clean on HPUX itanium. Thanks in advance!

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.