Skip to content

Commit

Permalink
Merge pull request #58 from jinfeihan57/dev
Browse files Browse the repository at this point in the history
fix issue 56 and fix make test error
  • Loading branch information
jinfeihan57 authored Jul 1, 2020
2 parents ba539b4 + 1ad0c59 commit 36272c6
Show file tree
Hide file tree
Showing 7 changed files with 192 additions and 8 deletions.
2 changes: 2 additions & 0 deletions CPP/7zip/Archive/7z/7zCompressionMode.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,9 @@ struct CMethodFull: public CMethodProps
{
CMethodId Id;
UInt32 NumStreams;
int CodecIndex;

CMethodFull(): CodecIndex(-1) {}
bool IsSimpleCoder() const { return NumStreams == 1; }
};

Expand Down
14 changes: 13 additions & 1 deletion CPP/7zip/Archive/7z/7zEncode.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -154,9 +154,21 @@ HRESULT CEncoder::CreateMixerCoder(

CCreatedCoder cod;

RINOK(CreateCoder(
// RINOK(CreateCoder(
// EXTERNAL_CODECS_LOC_VARS
// methodFull.Id, true, cod));
if (methodFull.CodecIndex >= 0)
{
RINOK(CreateCoder_Index(
EXTERNAL_CODECS_LOC_VARS
methodFull.CodecIndex, true, cod));
}
else
{
RINOK(CreateCoder_Id(
EXTERNAL_CODECS_LOC_VARS
methodFull.Id, true, cod));
}

if (cod.NumStreams != methodFull.NumStreams)
return E_FAIL;
Expand Down
6 changes: 4 additions & 2 deletions CPP/7zip/Archive/7z/7zHandlerOut.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,11 @@ STDMETHODIMP CHandler::GetFileTimeType(UInt32 *type)

HRESULT CHandler::PropsMethod_To_FullMethod(CMethodFull &dest, const COneMethodInfo &m)
{
if (!FindMethod(
dest.CodecIndex = FindMethod_Index(
EXTERNAL_CODECS_VARS
m.MethodName, dest.Id, dest.NumStreams))
m.MethodName, true,
dest.Id, dest.NumStreams);
if (dest.CodecIndex < 0)
return E_INVALIDARG;
(CProps &)dest = (CProps &)m;
return S_OK;
Expand Down
8 changes: 7 additions & 1 deletion CPP/7zip/UI/Client7z/Client7z.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -208,7 +208,7 @@ class CArchiveExtractCallback:
STDMETHOD(GetStream)(UInt32 index, ISequentialOutStream **outStream, Int32 askExtractMode);
STDMETHOD(PrepareOperation)(Int32 askExtractMode);
STDMETHOD(SetOperationResult)(Int32 resultEOperationResult);

virtual bool SetFileSymLinkAttrib();
// ICryptoGetTextPassword
STDMETHOD(CryptoGetTextPassword)(BSTR *aPassword);

Expand Down Expand Up @@ -244,6 +244,12 @@ class CArchiveExtractCallback:
CArchiveExtractCallback() : PasswordIsDefined(false) {}
};

bool CArchiveExtractCallback::SetFileSymLinkAttrib()
{
/* Do nothing */
return S_OK;
}

void CArchiveExtractCallback::Init(IInArchive *archiveHandler, const FString &directoryPath)
{
NumErrors = 0;
Expand Down
162 changes: 162 additions & 0 deletions check/check_7za.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,162 @@
#! /bin/sh

sure()
{
eval $*
if [ "$?" != "0" ]
then
echo "ERROR during : $*"
echo "ERROR during : $*" > last_error
exit 1
fi
}

#set -x

P7ZIP="$@"
P7ZIP="${TOOLS} ${P7ZIP}"

REP=TMP_$$
echo "REP=${REP}"
echo "P7ZIP=${P7ZIP}"
echo "TOOLS=${TOOLS}"

chmod -R 777 ${REP} 2> /dev/null
rm -fr ${REP}
mkdir -p ${REP}

cd ${REP}

# sure rm -fr 7za433_ref 7za433_7zip_bzip2 7za433_7zip_lzma 7za433_7zip_lzma_crypto 7za433_7zip_ppmd 7za433_tar
# sure rm -fr 7za433_7zip_bzip2.7z 7za433_7zip_lzma.7z 7za433_7zip_lzma_crypto.7z 7za433_7zip_ppmd.7z 7za433_tar.tar

echo ""
echo "# TESTING ..."
echo "#############"

sure ${P7ZIP} t ../test/7za433_tar.tar
sure ${P7ZIP} t ../test/7za433_7zip_lzma.7z
sure ${P7ZIP} t -pqwerty ../test/7za433_7zip_lzma_crypto.7z
sure ${P7ZIP} t ../test/7za433_7zip_ppmd.7z
sure ${P7ZIP} t ../test/7za433_7zip_bzip2.7z

echo ""
echo "# EXTRACTING ..."
echo "################"

sure tar xf ../test/7za433_tar.tar
sure mv 7za433_tar 7za433_ref

sure ${P7ZIP} x ../test/7za433_tar.tar
sure diff -r 7za433_ref 7za433_tar

sure ${P7ZIP} x ../test/7za433_7zip_lzma.7z
sure diff -r 7za433_ref 7za433_7zip_lzma

sure ${P7ZIP} x ../test/7za433_7zip_lzma_bcj2.7z
sure diff -r 7za433_ref 7za433_7zip_lzma_bcj2

sure ${P7ZIP} x -pqwerty ../test/7za433_7zip_lzma_crypto.7z
sure diff -r 7za433_ref 7za433_7zip_lzma_crypto

sure ${P7ZIP} x ../test/7za433_7zip_ppmd.7z
sure diff -r 7za433_ref 7za433_7zip_ppmd

sure ${P7ZIP} x ../test/7za433_7zip_ppmd_bcj2.7z
sure diff -r 7za433_ref 7za433_7zip_ppmd_bcj2

sure ${P7ZIP} x ../test/7za433_7zip_bzip2.7z
sure diff -r 7za433_ref 7za433_7zip_bzip2

echo ""
echo "# Archiving ..."
echo "###############"

sure ${P7ZIP} a -ttar 7za433_tar.tar 7za433_tar
sure tar tvf 7za433_tar.tar

sure ${P7ZIP} a 7za433_7zip_lzma.7z 7za433_7zip_lzma

sure ${P7ZIP} a -sfx7zCon.sfx 7za433_7zip_lzma.x 7za433_7zip_lzma

sure ${P7ZIP} a -pqwerty -mhc=on -mhe=on 7za433_7zip_lzma_crypto.7z 7za433_7zip_lzma_crypto # -p = password

sure ${P7ZIP} a -mx=9 -m0=ppmd:mem=64m:o=32 7za433_7zip_ppmd.7z 7za433_7zip_ppmd

sure ${P7ZIP} a -m0=bzip2 7za433_7zip_bzip2.7z 7za433_7zip_bzip2

echo ""
echo "# EXTRACTING (PASS 2) ..."
echo "#########################"

sure rm -fr 7za433_7zip_bzip2 7za433_7zip_lzma 7za433_7zip_lzma_crypto 7za433_7zip_ppmd 7za433_tar

sure ${P7ZIP} x 7za433_tar.tar
sure diff -r 7za433_ref 7za433_tar

sure ${P7ZIP} x 7za433_7zip_lzma.7z
sure diff -r 7za433_ref 7za433_7zip_lzma

sure rm -fr 7za433_7zip_lzma
# FIXME - only for 7zG
sure chmod +x ./7za433_7zip_lzma.x
# sure ${P7ZIP} x -sfx7zCon.sfx 7za433_7zip_lzma.x
sure ${TOOLS} ./7za433_7zip_lzma.x
sure diff -r 7za433_ref 7za433_7zip_lzma
sure rm -rf 7za433_7zip_lzma

sure ${P7ZIP} x -pqwerty 7za433_7zip_lzma_crypto.7z
sure diff -r 7za433_ref 7za433_7zip_lzma_crypto

sure ${P7ZIP} x 7za433_7zip_ppmd.7z
sure diff -r 7za433_ref 7za433_7zip_ppmd

sure ${P7ZIP} x 7za433_7zip_bzip2.7z
sure diff -r 7za433_ref 7za433_7zip_bzip2

echo ""
echo "# EXTRACTING (LZMA) ..."
echo "#######################"

rm -f 7za.exe

sure ${P7ZIP} x ../test/7za.exe.lzma
sure diff 7za.exe 7za433_ref/bin/7za.exe
sure rm -f 7za.exe

sure ${P7ZIP} x ../test/7za.exe.lzma86
sure diff 7za.exe 7za433_ref/bin/7za.exe
sure rm -f 7za.exe

sure ${P7ZIP} x ../test/7za.exe.lzma_eos
sure diff 7za.exe 7za433_ref/bin/7za.exe
sure rm -f 7za.exe


echo ""
echo "# TESTING (XZ) ..."
echo "#######################"
sure ${P7ZIP} x ../test/7za.exe.xz
sure diff 7za.exe 7za433_ref/bin/7za.exe

chmod +x 7za.exe
sure ${P7ZIP} -txz a 7za.exe.xz 7za.exe
sure rm -f 7za.exe

sure ${P7ZIP} x 7za.exe.xz
sure diff 7za.exe 7za433_ref/bin/7za.exe
sure rm -f 7za.exe

#####################################

cd ..

# ./clean_all.sh
chmod -R 777 ${REP} 2> /dev/null
rm -fr ${REP}

echo ""
echo "==========="
echo "ALL SUCCESS"
echo "==========="
echo ""
6 changes: 3 additions & 3 deletions check/check_Client7z.sh
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ chmod -R 777 ${REP} 2> /dev/null
rm -fr ${REP}

echo ""
echo "========"
echo "ALL DONE"
echo "========"
echo "==========="
echo "ALL SUCCESS"
echo "==========="
echo ""
2 changes: 1 addition & 1 deletion makefile.common
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ clean_full:clean
chmod +x install.sh check/*.sh

test: 7za sfx
cd check ; TOOLS="${TOOLS}" ./check.sh "`pwd`/../bin/7za"
cd check ; TOOLS="${TOOLS}" ./check_7za.sh "`pwd`/../bin/7za"

test_7z: 7z sfx
cd check ; TOOLS="${TOOLS}" ./check.sh "`pwd`/../bin/7z"
Expand Down

0 comments on commit 36272c6

Please sign in to comment.