Menu

#339 update Lzma86.h : fix typo

None
closed
nobody
None
5
2019-07-29
2019-07-16
Bruce Stark
No

In the comment of the Lzma86_Encode() method, the Return code type may be SZ_ERROR_FAIL, so we should also add SZ_ERROR_FAIL in comment, which seems more rigorous.

Lzma86.h file in line 56:

/*
Lzma86_Encode
-------------
Return code:
      SZ_OK                   - OK
      SZ_ERROR_MEM            - Memory allocation error
      SZ_ERROR_PARAM          - Incorrect paramater
      SZ_ERROR_OUTPUT_EOF     - output buffer overflow
      SZ_ERROR_THREAD         - errors in multithreading functions (only for Mt version)
*/

In fact:

Lzma86_Encode(){
    ...
    LzmaEncode(){
        ...
        LzmaEnc_MemEncode(){
            ...
             res = LzmaEnc_MemPrepare(pp, src, srcLen, 0, alloc, allocBig);
             if (res == SZ_OK)
            {
             res = LzmaEnc_Encode2(p, progress); 
             if (res == SZ_OK && p->nowPos64 != srcLen)
                  res = SZ_ERROR_FAIL;
             }
             ...
        }
        ...
    }
    ...
}

Discussion

  • Bruce Stark

    Bruce Stark - 2019-07-16
     

    Last edit: Bruce Stark 2019-07-16
  • Igor Pavlov

    Igor Pavlov - 2019-07-16

    I suppose that this error case can mean some internal failure in 7-Zip source code.
    So it's impossible to get that return value code.
    We just use that check to ensure that the internal code worked as expected.

     
  • Bruce Stark

    Bruce Stark - 2019-07-17

    Thanks for your reply.
    I suppose if it's impossible to get that return value code here, then it's unnecessary to add a judgment statement.

    I suppose that this error case can mean some internal failure in 7-Zip source code.
    

    By the way, what are some internal failure in 7-Zip source code?

     
  • Igor Pavlov

    Igor Pavlov - 2019-07-17

    Source code can have bugs or errors.
    And it's better to show some return code, if something doesn't work as expected.
    If you get such failure for some data, you must stop using that code and report developers about that problem.
    It's unusual situation in most cases.

     

    Last edit: Igor Pavlov 2019-07-17
  • Bruce Stark

    Bruce Stark - 2019-07-29

    ok,I see. Please close the ticket . Thanks again.

     

    Last edit: Bruce Stark 2019-07-29
  • Igor Pavlov

    Igor Pavlov - 2019-07-29
    • status: open --> closed
    • Group: -->
     

Log in to post a comment.

MongoDB Logo MongoDB