Remove ErrorOut function

- replace the ErrorOut function with a simple return E_FAIL
- there is non reason to call some MessageBox()
This commit is contained in:
Tino Reichardt
2018-10-31 10:44:47 +01:00
parent 089a2d7574
commit ed069bab9e
18 changed files with 10 additions and 112 deletions

View File

@@ -133,6 +133,7 @@ C_OBJS = \
!include "../../LzmaDec.mak" !include "../../LzmaDec.mak"
COMPRESS_OBJS = $(COMPRESS_OBJS) \ COMPRESS_OBJS = $(COMPRESS_OBJS) \
$O\ZstdEncoder.obj \
$O\ZstdDecoder.obj \ $O\ZstdDecoder.obj \
$O\ZstdRegister.obj \ $O\ZstdRegister.obj \

View File

@@ -152,6 +152,7 @@ C_OBJS = \
!include "../../LzmaDec.mak" !include "../../LzmaDec.mak"
COMPRESS_OBJS = $(COMPRESS_OBJS) \ COMPRESS_OBJS = $(COMPRESS_OBJS) \
$O\ZstdEncoder.obj \
$O\ZstdDecoder.obj \ $O\ZstdDecoder.obj \
$O\ZstdRegister.obj \ $O\ZstdRegister.obj \

View File

@@ -83,18 +83,6 @@ CDecoder::~CDecoder()
{ {
} }
HRESULT CDecoder::ErrorOut(size_t code)
{
const char *strError = BROTLIMT_getErrorString(code);
wchar_t wstrError[200+5]; /* no malloc here, /TR */
mbstowcs(wstrError, strError, 200);
MessageBoxW(0, wstrError, L"7-Zip Zstandard", MB_ICONERROR | MB_OK);
MyFree(wstrError);
return S_FALSE;
}
STDMETHODIMP CDecoder::SetDecoderProperties2(const Byte * prop, UInt32 size) STDMETHODIMP CDecoder::SetDecoderProperties2(const Byte * prop, UInt32 size)
{ {
DProps *pProps = (DProps *)prop; DProps *pProps = (DProps *)prop;
@@ -162,7 +150,7 @@ HRESULT CDecoder::CodeSpec(ISequentialInStream * inStream,
if (BROTLIMT_isError(result)) { if (BROTLIMT_isError(result)) {
if (result == (size_t)-BROTLIMT_error_canceled) if (result == (size_t)-BROTLIMT_error_canceled)
return E_ABORT; return E_ABORT;
return ErrorOut(result); return E_FAIL;
} }
/* 4) free resources */ /* 4) free resources */

View File

@@ -58,7 +58,6 @@ class CDecoder:public ICompressCoder,
UInt32 _inputSize; UInt32 _inputSize;
UInt32 _numThreads; UInt32 _numThreads;
HRESULT CDecoder::ErrorOut(size_t code);
HRESULT CodeSpec(ISequentialInStream *inStream, ISequentialOutStream *outStream, ICompressProgressInfo *progress); HRESULT CodeSpec(ISequentialInStream *inStream, ISequentialOutStream *outStream, ICompressProgressInfo *progress);
HRESULT SetOutStreamSizeResume(const UInt64 *outSize); HRESULT SetOutStreamSizeResume(const UInt64 *outSize);

View File

@@ -24,18 +24,6 @@ CEncoder::~CEncoder()
BROTLIMT_freeCCtx(_ctx); BROTLIMT_freeCCtx(_ctx);
} }
HRESULT CEncoder::ErrorOut(size_t code)
{
const char *strError = BROTLIMT_getErrorString(code);
wchar_t wstrError[200+5]; /* no malloc here, /TR */
mbstowcs(wstrError, strError, 200);
MessageBoxW(0, wstrError, L"7-Zip Zstandard", MB_ICONERROR | MB_OK);
MyFree(wstrError);
return S_FALSE;
}
STDMETHODIMP CEncoder::SetCoderProperties(const PROPID * propIDs, const PROPVARIANT * coderProps, UInt32 numProps) STDMETHODIMP CEncoder::SetCoderProperties(const PROPID * propIDs, const PROPVARIANT * coderProps, UInt32 numProps)
{ {
_props.clear(); _props.clear();
@@ -120,7 +108,7 @@ STDMETHODIMP CEncoder::Code(ISequentialInStream *inStream,
if (BROTLIMT_isError(result)) { if (BROTLIMT_isError(result)) {
if (result == (size_t)-BROTLIMT_error_canceled) if (result == (size_t)-BROTLIMT_error_canceled)
return E_ABORT; return E_ABORT;
return ErrorOut(result); return E_FAIL;
} }
return res; return res;

View File

@@ -46,7 +46,6 @@ class CEncoder:
UInt32 _numThreads; UInt32 _numThreads;
BROTLIMT_CCtx *_ctx; BROTLIMT_CCtx *_ctx;
HRESULT CEncoder::ErrorOut(size_t code);
public: public:
MY_QUERYINTERFACE_BEGIN2(ICompressCoder) MY_QUERYINTERFACE_BEGIN2(ICompressCoder)

View File

@@ -83,18 +83,6 @@ CDecoder::~CDecoder()
{ {
} }
HRESULT CDecoder::ErrorOut(size_t code)
{
const char *strError = LIZARDMT_getErrorString(code);
wchar_t wstrError[200+5]; /* no malloc here, /TR */
mbstowcs(wstrError, strError, 200);
MessageBoxW(0, wstrError, L"7-Zip Zstandard", MB_ICONERROR | MB_OK);
MyFree(wstrError);
return S_FALSE;
}
STDMETHODIMP CDecoder::SetDecoderProperties2(const Byte * prop, UInt32 size) STDMETHODIMP CDecoder::SetDecoderProperties2(const Byte * prop, UInt32 size)
{ {
DProps *pProps = (DProps *)prop; DProps *pProps = (DProps *)prop;
@@ -162,7 +150,7 @@ HRESULT CDecoder::CodeSpec(ISequentialInStream * inStream,
if (LIZARDMT_isError(result)) { if (LIZARDMT_isError(result)) {
if (result == (size_t)-LIZARDMT_error_canceled) if (result == (size_t)-LIZARDMT_error_canceled)
return E_ABORT; return E_ABORT;
return ErrorOut(result); return E_FAIL;
} }
/* 4) free resources */ /* 4) free resources */

View File

@@ -60,7 +60,6 @@ class CDecoder:public ICompressCoder,
UInt32 _inputSize; UInt32 _inputSize;
UInt32 _numThreads; UInt32 _numThreads;
HRESULT CDecoder::ErrorOut(size_t code);
HRESULT CodeSpec(ISequentialInStream *inStream, ISequentialOutStream *outStream, ICompressProgressInfo *progress); HRESULT CodeSpec(ISequentialInStream *inStream, ISequentialOutStream *outStream, ICompressProgressInfo *progress);
HRESULT SetOutStreamSizeResume(const UInt64 *outSize); HRESULT SetOutStreamSizeResume(const UInt64 *outSize);

View File

@@ -24,18 +24,6 @@ CEncoder::~CEncoder()
LIZARDMT_freeCCtx(_ctx); LIZARDMT_freeCCtx(_ctx);
} }
HRESULT CEncoder::ErrorOut(size_t code)
{
const char *strError = LIZARDMT_getErrorString(code);
wchar_t wstrError[200+5]; /* no malloc here, /TR */
mbstowcs(wstrError, strError, 200);
MessageBoxW(0, wstrError, L"7-Zip Zstandard", MB_ICONERROR | MB_OK);
MyFree(wstrError);
return S_FALSE;
}
STDMETHODIMP CEncoder::SetCoderProperties(const PROPID * propIDs, const PROPVARIANT * coderProps, UInt32 numProps) STDMETHODIMP CEncoder::SetCoderProperties(const PROPID * propIDs, const PROPVARIANT * coderProps, UInt32 numProps)
{ {
_props.clear(); _props.clear();
@@ -121,7 +109,7 @@ STDMETHODIMP CEncoder::Code(ISequentialInStream *inStream,
if (LIZARDMT_isError(result)) { if (LIZARDMT_isError(result)) {
if (result == (size_t)-LIZARDMT_error_canceled) if (result == (size_t)-LIZARDMT_error_canceled)
return E_ABORT; return E_ABORT;
return ErrorOut(result); return E_FAIL;
} }
return res; return res;

View File

@@ -47,7 +47,6 @@ class CEncoder:
UInt32 _numThreads; UInt32 _numThreads;
LIZARDMT_CCtx *_ctx; LIZARDMT_CCtx *_ctx;
HRESULT CEncoder::ErrorOut(size_t code);
public: public:
MY_QUERYINTERFACE_BEGIN2(ICompressCoder) MY_QUERYINTERFACE_BEGIN2(ICompressCoder)

View File

@@ -83,18 +83,6 @@ CDecoder::~CDecoder()
{ {
} }
HRESULT CDecoder::ErrorOut(size_t code)
{
const char *strError = LZ4MT_getErrorString(code);
wchar_t wstrError[200+5]; /* no malloc here, /TR */
mbstowcs(wstrError, strError, 200);
MessageBoxW(0, wstrError, L"7-Zip Zstandard", MB_ICONERROR | MB_OK);
MyFree(wstrError);
return S_FALSE;
}
STDMETHODIMP CDecoder::SetDecoderProperties2(const Byte * prop, UInt32 size) STDMETHODIMP CDecoder::SetDecoderProperties2(const Byte * prop, UInt32 size)
{ {
DProps *pProps = (DProps *)prop; DProps *pProps = (DProps *)prop;
@@ -162,7 +150,7 @@ HRESULT CDecoder::CodeSpec(ISequentialInStream * inStream,
if (LZ4MT_isError(result)) { if (LZ4MT_isError(result)) {
if (result == (size_t)-LZ4MT_error_canceled) if (result == (size_t)-LZ4MT_error_canceled)
return E_ABORT; return E_ABORT;
return ErrorOut(result); return E_FAIL;
} }
/* 4) free resources */ /* 4) free resources */

View File

@@ -59,7 +59,6 @@ class CDecoder:public ICompressCoder,
UInt32 _inputSize; UInt32 _inputSize;
UInt32 _numThreads; UInt32 _numThreads;
HRESULT CDecoder::ErrorOut(size_t code);
HRESULT CodeSpec(ISequentialInStream *inStream, ISequentialOutStream *outStream, ICompressProgressInfo *progress); HRESULT CodeSpec(ISequentialInStream *inStream, ISequentialOutStream *outStream, ICompressProgressInfo *progress);
HRESULT SetOutStreamSizeResume(const UInt64 *outSize); HRESULT SetOutStreamSizeResume(const UInt64 *outSize);

View File

@@ -24,18 +24,6 @@ CEncoder::~CEncoder()
LZ4MT_freeCCtx(_ctx); LZ4MT_freeCCtx(_ctx);
} }
HRESULT CEncoder::ErrorOut(size_t code)
{
const char *strError = LZ4MT_getErrorString(code);
wchar_t wstrError[200+5]; /* no malloc here, /TR */
mbstowcs(wstrError, strError, 200);
MessageBoxW(0, wstrError, L"7-Zip Zstandard", MB_ICONERROR | MB_OK);
MyFree(wstrError);
return S_FALSE;
}
STDMETHODIMP CEncoder::SetCoderProperties(const PROPID * propIDs, const PROPVARIANT * coderProps, UInt32 numProps) STDMETHODIMP CEncoder::SetCoderProperties(const PROPID * propIDs, const PROPVARIANT * coderProps, UInt32 numProps)
{ {
_props.clear(); _props.clear();
@@ -121,7 +109,7 @@ STDMETHODIMP CEncoder::Code(ISequentialInStream *inStream,
if (LZ4MT_isError(result)) { if (LZ4MT_isError(result)) {
if (result == (size_t)-LZ4MT_error_canceled) if (result == (size_t)-LZ4MT_error_canceled)
return E_ABORT; return E_ABORT;
return ErrorOut(result); return E_FAIL;
} }
return res; return res;

View File

@@ -47,7 +47,6 @@ class CEncoder:
UInt32 _numThreads; UInt32 _numThreads;
LZ4MT_CCtx *_ctx; LZ4MT_CCtx *_ctx;
HRESULT CEncoder::ErrorOut(size_t code);
public: public:
MY_QUERYINTERFACE_BEGIN2(ICompressCoder) MY_QUERYINTERFACE_BEGIN2(ICompressCoder)

View File

@@ -83,18 +83,6 @@ CDecoder::~CDecoder()
{ {
} }
HRESULT CDecoder::ErrorOut(size_t code)
{
const char *strError = LZ5MT_getErrorString(code);
wchar_t wstrError[200+5]; /* no malloc here, /TR */
mbstowcs(wstrError, strError, 200);
MessageBoxW(0, wstrError, L"7-Zip Zstandard", MB_ICONERROR | MB_OK);
MyFree(wstrError);
return S_FALSE;
}
STDMETHODIMP CDecoder::SetDecoderProperties2(const Byte * prop, UInt32 size) STDMETHODIMP CDecoder::SetDecoderProperties2(const Byte * prop, UInt32 size)
{ {
DProps *pProps = (DProps *)prop; DProps *pProps = (DProps *)prop;
@@ -162,7 +150,7 @@ HRESULT CDecoder::CodeSpec(ISequentialInStream * inStream,
if (LZ5MT_isError(result)) { if (LZ5MT_isError(result)) {
if (result == (size_t)-LZ5MT_error_canceled) if (result == (size_t)-LZ5MT_error_canceled)
return E_ABORT; return E_ABORT;
return ErrorOut(result); return E_FAIL;
} }
/* 4) free resources */ /* 4) free resources */

View File

@@ -59,7 +59,6 @@ class CDecoder:public ICompressCoder,
UInt32 _inputSize; UInt32 _inputSize;
UInt32 _numThreads; UInt32 _numThreads;
HRESULT CDecoder::ErrorOut(size_t code);
HRESULT CodeSpec(ISequentialInStream *inStream, ISequentialOutStream *outStream, ICompressProgressInfo *progress); HRESULT CodeSpec(ISequentialInStream *inStream, ISequentialOutStream *outStream, ICompressProgressInfo *progress);
HRESULT SetOutStreamSizeResume(const UInt64 *outSize); HRESULT SetOutStreamSizeResume(const UInt64 *outSize);

View File

@@ -24,18 +24,6 @@ CEncoder::~CEncoder()
LZ5MT_freeCCtx(_ctx); LZ5MT_freeCCtx(_ctx);
} }
HRESULT CEncoder::ErrorOut(size_t code)
{
const char *strError = LZ5MT_getErrorString(code);
wchar_t wstrError[200+5]; /* no malloc here, /TR */
mbstowcs(wstrError, strError, 200);
MessageBoxW(0, wstrError, L"7-Zip Zstandard", MB_ICONERROR | MB_OK);
MyFree(wstrError);
return S_FALSE;
}
STDMETHODIMP CEncoder::SetCoderProperties(const PROPID * propIDs, const PROPVARIANT * coderProps, UInt32 numProps) STDMETHODIMP CEncoder::SetCoderProperties(const PROPID * propIDs, const PROPVARIANT * coderProps, UInt32 numProps)
{ {
_props.clear(); _props.clear();
@@ -121,7 +109,7 @@ STDMETHODIMP CEncoder::Code(ISequentialInStream *inStream,
if (LZ5MT_isError(result)) { if (LZ5MT_isError(result)) {
if (result == (size_t)-LZ5MT_error_canceled) if (result == (size_t)-LZ5MT_error_canceled)
return E_ABORT; return E_ABORT;
return ErrorOut(result); return E_FAIL;
} }
return res; return res;

View File

@@ -47,7 +47,6 @@ class CEncoder:
UInt32 _numThreads; UInt32 _numThreads;
LZ5MT_CCtx *_ctx; LZ5MT_CCtx *_ctx;
HRESULT CEncoder::ErrorOut(size_t code);
public: public:
MY_QUERYINTERFACE_BEGIN2(ICompressCoder) MY_QUERYINTERFACE_BEGIN2(ICompressCoder)