Menu

Using LZMA SDK 19.00 with p7zip 16.02

Anonymous
2020-01-18
2021-04-04
  • Anonymous

    Anonymous - 2020-01-18

    I only work with a small subset of files in the /C directory, but I have been able to insert SDK 19 code into my projects with the following files modified.

    After copying files from /C in lzma SDK 19.00

    Edit MtCoder.h and uncomment
    /* #define MTCODER__USE_WRITE_THREAD */

    Copy over Threads.c and Threads.h from p7zip 16.02
    Edit Threads.h and add this line around line 90
    #define Semaphore_IsCreated(p) ((CSemaphore *) (p) != NULL)

    YMMV, but these small changes allowed me to use SDK 19 in my code. Hope this helps.

     
    👍
    1
  • Sam Tansy

    Sam Tansy - 2021-04-04

    I have tried that with p7zip.
    So there are changes to MtCoder. and

    --- p7zip_16.04/C/MtCoder.h     2018-07-04 13:00:00.000000000 +0200
    +++ p7zip_16.04+lzma-19.00/C/MtCoder.h  2021-04-04 00:47:29.000000000 +0200
    @@ -12,7 +12,7 @@ EXTERN_C_BEGIN
       if (    defined MTCODER__USE_WRITE_THREAD) : main thread writes all data blocks to output stream
       if (not defined MTCODER__USE_WRITE_THREAD) : any coder thread can write data blocks to output stream
     */
    -/* #define MTCODER__USE_WRITE_THREAD */
    +#define MTCODER__USE_WRITE_THREAD
    
     #ifndef _7ZIP_ST
       #define MTCODER__GET_NUM_BLOCKS_FROM_THREADS(numThreads) ((numThreads) + (numThreads) / 8 + 1)
    --- p7zip_16.04/C/Threads.h     2014-12-21 14:23:30.000000000 +0100
    +++ p7zip_16.04+lzma-19.00/C/Threads.h  2021-04-04 00:45:01.000000000 +0200
    @@ -87,6 +87,7 @@ typedef struct _CSemaphore
     } CSemaphore;
    
     #define Semaphore_Construct(p) (p)->_created = 0
    +#define Semaphore_IsCreated(p) ((CSemaphore *) (p) != NULL)
    
     WRes Semaphore_Create(CSemaphore *p, UInt32 initiallyCount, UInt32 maxCount);
     WRes Semaphore_ReleaseN(CSemaphore *p, UInt32 num);
    

    and to 7zTypes.h v19.00:

    ```diff
    --- 7z1900-src/C/7zTypes.h 2018-08-04 15:00:00.000000000 +0200
    +++ p7zip_16.04+lzma-19.00/C/7zTypes.h 2021-04-04 01:39:57.000000000 +0200
    @@ -104,7 +104,7 @@ typedef size_t SizeT;
    #endif

    typedef int BoolInt;
    -/ typedef BoolInt Bool; /
    +typedef BoolInt Bool;
    #define True 1
    #define False 0

    ```

    But I still get lots of errors. I guess p7zip is bit too complicated and so far behind that it's not going to be this easy.

     

    Last edit: Sam Tansy 2021-04-04
    • Anonymous

      Anonymous - 2021-04-04

      No Sam. The 19.00 SDK is not consistent with p7zip. You must use SDK 19.00 files. I was not able to upgrade p7zip. However, I limited myself to the C code and a small subset of LZMA files.

       

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.