@@ -206,7 +206,6 @@ static void usage_advanced(const char* programName)
206206 DISPLAYOUT ( "--ultra : enable levels beyond %i, up to %i (requires more memory) \n" , ZSTDCLI_CLEVEL_MAX , ZSTD_maxCLevel ());
207207 DISPLAYOUT ( "--long[=#]: enable long distance matching with given window log (default: %u) \n" , g_defaultMaxWindowLog );
208208 DISPLAYOUT ( "--fast[=#]: switch to very fast compression levels (default: %u) \n" , 1 );
209- DISPLAYOUT ( "--long-param=#: specify compression level, accepts negative values as fast compression levels \n" );
210209 DISPLAYOUT ( "--adapt : dynamically adapt compression level to I/O conditions \n" );
211210 DISPLAYOUT ( "--[no-]row-match-finder : force enable/disable usage of fast row-based matchfinder for greedy, lazy, and lazy2 strategies \n" );
212211 DISPLAYOUT ( "--patch-from=FILE : specify the file to be used as a reference point for zstd's diff engine. \n" );
@@ -355,25 +354,6 @@ static unsigned readU32FromChar(const char** stringPtr) {
355354 return result ;
356355}
357356
358- #ifndef ZSTD_NOCOMPRESS
359- /*! readIntFromChar() :
360- * @return : signed integer value read from input in `char` format.
361- * allows and interprets K, KB, KiB, M, MB and MiB suffix.
362- * Will also modify `*stringPtr`, advancing it to position where it stopped reading.
363- * Note : function will exit() program if digit sequence overflows */
364- static int readIntFromChar (const char * * stringPtr ) {
365- static const char errorMsg [] = "error: numeric value overflows 32-bit int" ;
366- int sign = 1 ;
367- unsigned result ;
368- if (* * stringPtr == '-' ) {
369- (* stringPtr )++ ;
370- sign = -1 ;
371- }
372- if (readU32FromCharChecked (stringPtr , & result )) { errorOut (errorMsg ); }
373- return (int ) result * sign ;
374- }
375- #endif
376-
377357/*! readSizeTFromCharChecked() :
378358 * @return 0 if success, and store the result in *value.
379359 * allows and interprets K, KB, KiB, M, MB and MiB suffix.
@@ -960,6 +940,23 @@ int main(int const argCount, const char* argv[])
960940 if (longCommandWArg (& argument , "--trace" )) { char const * traceFile ; NEXT_FIELD (traceFile ); TRACE_enable (traceFile ); continue ; }
961941#endif
962942 if (longCommandWArg (& argument , "--patch-from" )) { NEXT_FIELD (patchFromDictFileName ); continue ; }
943+ if (longCommandWArg (& argument , "--long" )) {
944+ unsigned ldmWindowLog = 0 ;
945+ ldmFlag = 1 ;
946+ /* Parse optional window log */
947+ if (* argument == '=' ) {
948+ ++ argument ;
949+ ldmWindowLog = readU32FromChar (& argument );
950+ } else if (* argument != 0 ) {
951+ /* Invalid character following --long */
952+ badusage (programName );
953+ CLEAN_RETURN (1 );
954+ }
955+ /* Only set windowLog if not already set by --zstd */
956+ if (compressionParams .windowLog == 0 )
957+ compressionParams .windowLog = ldmWindowLog ;
958+ continue ;
959+ }
963960#ifndef ZSTD_NOCOMPRESS /* linking ZSTD_minCLevel() requires compression support */
964961 if (longCommandWArg (& argument , "--fast" )) {
965962 /* Parse optional acceleration factor */
@@ -984,44 +981,8 @@ int main(int const argCount, const char* argv[])
984981 }
985982 continue ;
986983 }
987-
988- if (longCommandWArg (& argument , "--long-param" )) {
989- if (* argument == '=' ) {
990- int maxLevel = ZSTD_maxCLevel ();
991- int minLevel = ZSTD_minCLevel ();
992- int readLevel ;
993- ++ argument ;
994- readLevel = readIntFromChar (& argument );
995- if (readLevel > maxLevel ) readLevel = maxLevel ;
996- if (readLevel < minLevel ) readLevel = minLevel ;
997- cLevel = readLevel ;
998- } else {
999- /* --long-param requires an argument */
1000- badusage (programName );
1001- CLEAN_RETURN (1 );
1002- }
1003- continue ;
1004- }
1005984#endif
1006985
1007- if (longCommandWArg (& argument , "--long" )) {
1008- unsigned ldmWindowLog = 0 ;
1009- ldmFlag = 1 ;
1010- /* Parse optional window log */
1011- if (* argument == '=' ) {
1012- ++ argument ;
1013- ldmWindowLog = readU32FromChar (& argument );
1014- } else if (* argument != 0 ) {
1015- /* Invalid character following --long */
1016- badusage (programName );
1017- CLEAN_RETURN (1 );
1018- }
1019- /* Only set windowLog if not already set by --zstd */
1020- if (compressionParams .windowLog == 0 )
1021- compressionParams .windowLog = ldmWindowLog ;
1022- continue ;
1023- }
1024-
1025986 if (longCommandWArg (& argument , "--filelist" )) {
1026987 const char * listName ;
1027988 NEXT_FIELD (listName );
0 commit comments