@@ -505,44 +505,52 @@ int CoCompress(UBYTE *s)
505505 if ( StrICmp (s ,(UBYTE * )"on" ) == 0 ) {
506506 AC .NoCompress = 0 ;
507507 AR .gzipCompress = 0 ;
508+ return (0 );
508509 }
509510 else if ( StrICmp (s ,(UBYTE * )"off" ) == 0 ) {
510511 AC .NoCompress = 1 ;
511512 AR .gzipCompress = 0 ;
513+ return (0 );
512514 }
513515 else {
514516 t = s ; while ( FG .cTable [* t ] <= 1 ) t ++ ;
515517 c = * t ; * t = 0 ;
516518 if ( StrICmp (s ,(UBYTE * )"zstd" ) == 0 ) {
517- #ifndef WITHZSTD
518- Warning ("zstd compression not supported on this platform" );
519+ #ifdef WITHZSTD
520+ ZWRAP_useZSTDcompression (1 );
521+ #else
522+ Warning ("zstd compression not supported on this platform." );
519523#endif
520524 }
521- if ( ( StrICmp (s ,(UBYTE * )"gzip" ) == 0 ) || ( StrICmp (s ,(UBYTE * )"zstd" ) == 0 ) ) {
525+ else if ( StrICmp (s ,(UBYTE * )"gzip" ) == 0 ) {
526+ #ifdef WITHZSTD
527+ ZWRAP_useZSTDcompression (0 );
528+ #endif
522529#ifndef WITHZLIB
523- Warning ("gzip/zstd compression not supported on this platform" );
530+ Warning ("gzip compression not supported on this platform. " );
524531#endif
525- s = t ; * s = c ;
526- if ( * s == 0 ) {
527- AR .gzipCompress = GZIPDEFAULT ; /* Normally should be 6 */
528- return (0 );
529- }
530- while ( * s == ' ' || * s == ',' || * s == '\t' ) s ++ ;
531- t = s ;
532- if ( FG .cTable [* s ] == 1 ) {
533- AR .gzipCompress = * s - '0' ;
534- s ++ ;
535- while ( * s == ' ' || * s == ',' || * s == '\t' ) s ++ ;
536- if ( * s == 0 ) return (0 );
537- }
538- MesPrint ("&Unknown gzip/zstd option: %s. A digit was expected" ,t );
539- return (1 );
540-
541532 }
542533 else {
543- MesPrint ("&Unknown option: %s. On, off, gzip or zstd expected" ,s );
534+ MesPrint ("&Unknown Compress option: %s. On, off, gzip or zstd expected. " ,s );
544535 return (1 );
545536 }
537+
538+ /* Whether we are using zlib or zstd, accept and use a compression level. */
539+ s = t ; * s = c ;
540+ if ( * s == 0 ) {
541+ AR .gzipCompress = GZIPDEFAULT ; /* Normally should be 6 */
542+ return (0 );
543+ }
544+ while ( * s == ' ' || * s == ',' || * s == '\t' ) s ++ ;
545+ t = s ;
546+ if ( FG .cTable [* s ] == 1 ) {
547+ AR .gzipCompress = * s - '0' ;
548+ s ++ ;
549+ while ( * s == ' ' || * s == ',' || * s == '\t' ) s ++ ;
550+ if ( * s == 0 ) return (0 );
551+ }
552+ MesPrint ("&Unknown Compress gzip/zstd option: %s. A digit was expected." ,t );
553+ return (1 );
546554 }
547555 return (0 );
548556}
@@ -676,7 +684,7 @@ int CoOn(UBYTE *s)
676684 c = * s ; * s = 0 ;
677685 if ( StrICmp (t ,(UBYTE * )"gzip" ) == 0 ) {
678686#ifndef WITHZLIB
679- Warning ("gzip compression not supported on this platform" );
687+ Warning ("gzip compression not supported on this platform. " );
680688#endif
681689#ifdef WITHZSTD
682690 /* If gzip is specified, turn off zstd compression. zlib still goes via the wrapper. */
@@ -687,7 +695,7 @@ int CoOn(UBYTE *s)
687695#ifdef WITHZSTD
688696 ZWRAP_useZSTDcompression (1 );
689697#else
690- Warning ("zstd compression not supported on this platform" );
698+ Warning ("zstd compression not supported on this platform. " );
691699#endif
692700 }
693701 else {
@@ -709,7 +717,7 @@ int CoOn(UBYTE *s)
709717 AR .gzipCompress = GZIPDEFAULT ;
710718 }
711719 else {
712- MesPrint ("&Unrecognized option in ON compress gzip/zstd statement: %s, single digit expected" ,t );
720+ MesPrint ("&Unrecognized option in ON compress gzip/zstd statement: %s, single digit expected. " ,t );
713721 return (-1 );
714722 }
715723 }
0 commit comments