mirror of
https://github.com/facebook/zstd.git
synced 2025-08-05 19:15:58 +03:00
zstd -d writes to stdout when input is stdin
This commit is contained in:
@@ -83,7 +83,7 @@
|
|||||||
|
|
||||||
static const char* g_defaultDictName = "dictionary";
|
static const char* g_defaultDictName = "dictionary";
|
||||||
static const unsigned g_defaultMaxDictSize = 110 KB;
|
static const unsigned g_defaultMaxDictSize = 110 KB;
|
||||||
static const int g_defaultDictCLevel = 5;
|
static const int g_defaultDictCLevel = 3;
|
||||||
static const unsigned g_defaultSelectivityLevel = 9;
|
static const unsigned g_defaultSelectivityLevel = 9;
|
||||||
|
|
||||||
|
|
||||||
@@ -182,7 +182,7 @@ static void waitEnter(void)
|
|||||||
/*! readU32FromChar() :
|
/*! readU32FromChar() :
|
||||||
@return : unsigned integer value reach from input in `char` format
|
@return : unsigned integer value reach from input in `char` format
|
||||||
Will also modify `*stringPtr`, advancing it to position where it stopped reading.
|
Will also modify `*stringPtr`, advancing it to position where it stopped reading.
|
||||||
Note : this function can overflow if result > MAX_UINT */
|
Note : this function can overflow if digit string > MAX_UINT */
|
||||||
static unsigned readU32FromChar(const char** stringPtr)
|
static unsigned readU32FromChar(const char** stringPtr)
|
||||||
{
|
{
|
||||||
unsigned result = 0;
|
unsigned result = 0;
|
||||||
@@ -470,7 +470,7 @@ int main(int argCount, char** argv)
|
|||||||
|
|
||||||
/* Check if input/output defined as console; trigger an error in this case */
|
/* Check if input/output defined as console; trigger an error in this case */
|
||||||
if (!strcmp(filenameTable[0], stdinmark) && IS_CONSOLE(stdin) ) CLEAN_RETURN(badusage(programName));
|
if (!strcmp(filenameTable[0], stdinmark) && IS_CONSOLE(stdin) ) CLEAN_RETURN(badusage(programName));
|
||||||
if (outFileName && !strcmp(outFileName, stdoutmark) && IS_CONSOLE(stdout) && !(forceStdout && decode))
|
if (outFileName && !strcmp(outFileName, stdoutmark) && IS_CONSOLE(stdout) && strcmp(filenameTable[0], stdinmark) && !(forceStdout && decode))
|
||||||
CLEAN_RETURN(badusage(programName));
|
CLEAN_RETURN(badusage(programName));
|
||||||
|
|
||||||
/* user-selected output filename, only possible with a single file */
|
/* user-selected output filename, only possible with a single file */
|
||||||
|
@@ -41,6 +41,7 @@ $ECHO "\nStarting playTests.sh isWindows=$isWindows"
|
|||||||
[ -n "$ZSTD" ] || die "ZSTD variable must be defined!"
|
[ -n "$ZSTD" ] || die "ZSTD variable must be defined!"
|
||||||
|
|
||||||
file $ZSTD
|
file $ZSTD
|
||||||
|
|
||||||
$ECHO "\n**** simple tests **** "
|
$ECHO "\n**** simple tests **** "
|
||||||
|
|
||||||
./datagen > tmp
|
./datagen > tmp
|
||||||
@@ -51,6 +52,8 @@ $ZSTD -99 -f tmp # too large compression level, automatic sized down
|
|||||||
$ECHO "test : compress to stdout"
|
$ECHO "test : compress to stdout"
|
||||||
$ZSTD tmp -c > tmpCompressed
|
$ZSTD tmp -c > tmpCompressed
|
||||||
$ZSTD tmp --stdout > tmpCompressed # long command format
|
$ZSTD tmp --stdout > tmpCompressed # long command format
|
||||||
|
$ECHO "test : implied stdout when input is stdin"
|
||||||
|
$ECHO bob | $ZSTD | $ZSTD -d
|
||||||
$ECHO "test : null-length file roundtrip"
|
$ECHO "test : null-length file roundtrip"
|
||||||
$ECHO -n '' | $ZSTD - --stdout | $ZSTD -d --stdout
|
$ECHO -n '' | $ZSTD - --stdout | $ZSTD -d --stdout
|
||||||
$ECHO "test : decompress file with wrong suffix (must fail)"
|
$ECHO "test : decompress file with wrong suffix (must fail)"
|
||||||
|
Reference in New Issue
Block a user