diff --git a/src/compress.cpp b/src/compress.cpp index a96bb753..2351ad9e 100644 --- a/src/compress.cpp +++ b/src/compress.cpp @@ -83,6 +83,30 @@ #endif +/************************************************************************* +// +**************************************************************************/ + +unsigned upx_adler32(unsigned adler, const void *buf, unsigned len) +{ +#if defined(WITH_NRV) + return nrv_adler32(adler, (const nrv_byte *)buf, len); +#elif defined(WITH_UCL) + return ucl_adler32(adler, (const ucl_byte *)buf, len); +#endif +} + + +unsigned upx_adler32(const void *buf, unsigned len) +{ + //unsigned adler = upx_adler32(0, NULL, 0); + unsigned adler = 1; + assert(buf != NULL); + adler = upx_adler32(adler, buf, len); + return adler; +} + + /************************************************************************* // **************************************************************************/ diff --git a/src/conf.h b/src/conf.h index 20919e48..4af97666 100644 --- a/src/conf.h +++ b/src/conf.h @@ -70,7 +70,6 @@ # define upx_bytep ucl_bytep # define upx_bool ucl_bool # define upx_progress_callback_t ucl_progress_callback_t -# define upx_adler32 ucl_adler32 # define UPX_E_OK UCL_E_OK # define UPX_E_ERROR UCL_E_ERROR # define UPX_E_OUT_OF_MEMORY UCL_E_OUT_OF_MEMORY @@ -88,7 +87,6 @@ # define upx_bytep nrv_bytep # define upx_bool nrv_bool # define upx_progress_callback_t nrv_progress_callback_t -# define upx_adler32 nrv_adler32 # define UPX_E_OK NRV_E_OK # define UPX_E_ERROR NRV_E_ERROR # define UPX_E_OUT_OF_MEMORY NRV_E_OUT_OF_MEMORY @@ -592,6 +590,9 @@ void show_version(int); // compress.cpp +unsigned upx_adler32(const void *buf, unsigned len); +unsigned upx_adler32(unsigned adler, const void *buf, unsigned len); + #if defined(WITH_UCL) #define upx_compress_config_t ucl_compress_config_t #elif defined(WITH_NRV)