• Bug#1109782: unblock: 7zip/25.00+dfsg-1 (11/13)

    From Bastian Germann@21:1/5 to All on Wed Jul 23 19:40:02 2025
    [continued from previous message]

    + _method_for_Extraction.IsEmpty() ? NULL :
    + _method_for_Extraction.Ptr(),
    + (unsigned)hp.Hash.Size());
    if (!methods_loc.IsEmpty())
    {
    hb_Use = &hb_Loc;
    @@ -1621,7 +1753,7 @@
    Int32 opRes = NArchive::NExtract::NOperationResult::kUnsupportedMethod;
    if (isSupportedMode
    && res_SetMethods != E_NOTIMPL
    - && hb_Use->Hashers.Size() > 0
    + && !hb_Use->Hashers.IsEmpty()
    )
    {
    const CHasherState &hs = hb_Use->Hashers[0];
    @@ -1774,10 +1906,6 @@
    methods.Add(_methods[k]);
    }
    }
    - else if (_crcSize_WasSet)
    - {
    - AddDefaultMethod(methods, _crcSize);
    - }
    else
    {
    Z7_DECL_CMyComPtr_QI_FROM(
    @@ -1789,12 +1917,23 @@
    RINOK(getRootProps->GetRootProp(kpidArcFileName, &prop))
    if (prop.vt == VT_BSTR)
    {
    - const UString method = GetMethod_from_FileName(prop.bstrVal);
    + AString method;
    + /* const bool isKnownMethod = */ GetMethod_from_FileName(prop.bstrVal, method);
    if (!method.IsEmpty())
    - methods.Add(method);
    + {
    + AddDefaultMethod(methods, method, _crcSize_WasSet ? _crcSize : 0);
    + if (methods.IsEmpty())
    + return E_NOTIMPL;
    + }
    }
    }
    }
    + if (methods.IsEmpty() && _crcSize_WasSet)
    + {
    + AddDefaultMethod(methods,
    + NULL, // name
    + _crcSize);
    + }

    RINOK(hb.SetMethods(EXTERNAL_CODECS_LOC_VARS methods))

    @@ -2038,6 +2177,15 @@
    }


    +void CHandler::InitProps()
    +{
    + _supportWindowsBackslash = true;
    + _crcSize_WasSet = false;
    + _crcSize = 4;
    + _methods.Clear();
    + _options.Init_HashOptionsLocal();
    +}
    +
    Z7_COM7F_IMF(CHandler::SetProperties(const wchar_t * const *names, const PROPVARIANT *values, UInt32 numProps))
    {
    COM_TRY_BEGIN
    @@ -2088,22 +2236,27 @@
    " sha512"
    " sha384"
    " sha224"
    - // " sha512-224"
    - // " sha512-256"
    - // " sha3-224"
    + " sha512-224"
    + " sha512-256"
    + " sha3-224"
    " sha3-256"
    - // " sha3-384"
    - // " sha3-512"
    + " sha3-384"
    + " sha3-512"
    // " shake128"
    // " shake256"
    " sha1"
    + " sha2"
    + " sha3"
    " sha"
    " md5"
    + " blake2s"
    + " blake2b"
    " blake2sp"
    " xxh64"
    - " crc32 crc64"
    - " asc"
    + " crc32"
    + " crc64"
    " cksum"
    + " asc"
    // " b2sum"
    ),
    UString());
    diff -Nru 7zip-24.09+dfsg/CPP/7zip/UI/Common/HashCalc.h 7zip-25.00+dfsg/CPP/7zip/UI/Common/HashCalc.h
    --- 7zip-24.09+dfsg/CPP/7zip/UI/Common/HashCalc.h 2024-02-09 19:00:00.000000000 +0100
    +++ 7zip-25.00+dfsg/CPP/7zip/UI/Common/HashCalc.h 2024-12-09 10:00:00.000000000 +0100
    @@ -279,32 +279,25 @@
    bool _isArc;
    bool _supportWindowsBackslash;
    bool _crcSize_WasSet;
    - UInt64 _phySize;
    - CObjectVector<CHashPair> HashPairs;
    - UString _nameExtenstion;
    - // UString _method_fromName;
    - AString _pgpMethod;
    bool _is_CksumMode;
    bool _is_PgpMethod;
    bool _is_ZeroMode;
    bool _are_there_Tags;
    bool _are_there_Dirs;
    + bool _is_KnownMethod_in_FileName;
    bool _hashSize_Defined;
    unsigned _hashSize;
    UInt32 _crcSize;
    + UInt64 _phySize;
    + CObjectVector<CHashPair> HashPairs;
    UStringVector _methods;
    + AString _method_from_FileName;
    + AString _pgpMethod;
    + AString _method_for_Extraction;
    CHashOptionsLocal _options;

    void ClearVars();
    -
    - void InitProps()
    - {
    - _supportWindowsBackslash = true;
    - _crcSize_WasSet = false;
    - _crcSize = 4;
    - _me