@@ -2399,19 +2399,7 @@ newxzfile(const char *description, const char *mode, int type, int compress)
23992399 return new ;
24002400}
24012401
2402-
2403- #ifdef HAVE_ZSTD
2404-
2405- #ifndef HAVE_ZSTD_DECOMPRESSBOUND
2406- static unsigned long long ZSTD_decompressBound (const void * src , size_t srcSize ) {
2407- /* FIXME: it is stupid, but we could add a full streaming decompression pass as a fall-back */
2408- error ("The used zstd library does not include support for streaming decompression bounds so we cannot decompress streams in memory." );
2409- }
2410- #else
2411- /* seems silly, but this is needed to declare ZSTD_decompressBound */
24122402#define ZSTD_STATIC_LINKING_ONLY 1
2413- #endif
2414-
24152403#include <zstd.h>
24162404
24172405typedef struct zstdfileconn {
@@ -2661,15 +2649,6 @@ newzstdfile(const char *description, const char *mode, int compress)
26612649 return new ;
26622650}
26632651
2664- #else
2665- static Rconnection
2666- newzstdfile (const char * description , const char * mode , int compress ) {
2667- error ("Zstd compression support was not included in this R binary." );
2668- /* unreachable */
2669- return 0 ;
2670- }
2671- #endif
2672-
26732652typedef enum { COMP_UNKNOWN = 0 , COMP_GZ , COMP_BZ , COMP_XZ , COMP_ZSTD } comp_type ;
26742653
26752654static comp_type
@@ -6999,7 +6978,6 @@ SEXP R_decompress3(SEXP in, Rboolean *err)
69996978 lzma_end (& strm );
70006979#if 0 /* not enabled - just ready if we ever want to allow zstd */
70016980 } else if (type == 'S' ) {
7002- #ifdef HAVE_ZSTD
70036981 unsigned long long sz = ZSTD_getFrameContentSize (p + 5 , inlen - 5 );
70046982 if (sz == ZSTD_CONTENTSIZE_UNKNOWN ) /* possible streaming so no size in the header */
70056983 sz = ZSTD_decompressBound (p + 5 , inlen - 5 );
@@ -7009,9 +6987,6 @@ SEXP R_decompress3(SEXP in, Rboolean *err)
70096987 * err = TRUE;
70106988 return R_NilValue ;
70116989 }
7012- #else
7013- error ("Zstd compression support was not included in this R binary." );
7014- #endif
70156990#endif
70166991 } else if (type == '2' ) {
70176992 int res ;
@@ -7146,7 +7121,6 @@ do_memCompress(SEXP call, SEXP op, SEXP args, SEXP env)
71467121 break ;
71477122 }
71487123 case 5 : /* zstd */
7149- #ifdef HAVE_ZSTD
71507124 {
71517125 size_t inlen = XLENGTH (from );
71527126 size_t outlen = ZSTD_compressBound (inlen );
@@ -7159,9 +7133,6 @@ do_memCompress(SEXP call, SEXP op, SEXP args, SEXP env)
71597133 memcpy (RAW (ans ), buf , res );
71607134 break ;
71617135 }
7162- #else
7163- error ("Zstd compression support was not included in this R binary." );
7164- #endif
71657136 default :
71667137 break ;
71677138 }
@@ -7373,7 +7344,6 @@ do_memDecompress(SEXP call, SEXP op, SEXP args, SEXP env)
73737344 break ;
73747345 }
73757346 case 6 : /* zstd */
7376- #ifdef HAVE_ZSTD
73777347 {
73787348 size_t inlen = XLENGTH (from ), res ;
73797349 unsigned long long outlen ;
@@ -7393,9 +7363,6 @@ do_memDecompress(SEXP call, SEXP op, SEXP args, SEXP env)
73937363 memcpy (RAW (ans ), buf , res );
73947364 break ;
73957365 }
7396- #else
7397- error ("Zstd compression support was not included in this R binary." );
7398- #endif
73997366 // case 5 is "unknown', covered above
74007367 default :
74017368 break ;
0 commit comments