aboutsummaryrefslogtreecommitdiff
path: root/src/xz
diff options
context:
space:
mode:
authorLasse Collin <lasse.collin@tukaani.org>2023-01-24 00:05:38 +0200
committerJia Tan <jiat0218@gmail.com>2023-01-24 20:20:04 +0800
commit683a3c7e2fcd922200c31078e5c9dd1348e90941 (patch)
treec557a14754563d280330086fe8fa0a63b9d23785 /src/xz
parentxz: Refactor duplicated check for custom suffix when using --format=raw (diff)
downloadxz-683a3c7e2fcd922200c31078e5c9dd1348e90941.tar.xz
xz: Flip the return value of suffix_is_set to match the documentation.
Also edit style to match the existing coding style in the project.
Diffstat (limited to 'src/xz')
-rw-r--r--src/xz/args.c6
-rw-r--r--src/xz/suffix.c2
-rw-r--r--src/xz/suffix.h1
3 files changed, 5 insertions, 4 deletions
diff --git a/src/xz/args.c b/src/xz/args.c
index 3468e276..b831946f 100644
--- a/src/xz/args.c
+++ b/src/xz/args.c
@@ -726,9 +726,9 @@ args_parse(args_info *args, int argc, char **argv)
// If raw format is used and a custom suffix is not provided,
// then only stdout mode can be used when compressing or decompressing.
- if (opt_format == FORMAT_RAW && suffix_is_set() && !opt_stdout &&
- (opt_mode == MODE_COMPRESS ||
- opt_mode == MODE_DECOMPRESS))
+ if (opt_format == FORMAT_RAW && !suffix_is_set() && !opt_stdout
+ && (opt_mode == MODE_COMPRESS
+ || opt_mode == MODE_DECOMPRESS))
message_fatal(_("With --format=raw, --suffix=.SUF is "
"required unless writing to stdout"));
diff --git a/src/xz/suffix.c b/src/xz/suffix.c
index a9cdbd8a..6ce97878 100644
--- a/src/xz/suffix.c
+++ b/src/xz/suffix.c
@@ -397,5 +397,5 @@ suffix_set(const char *suffix)
extern bool
suffix_is_set(void)
{
- return custom_suffix == NULL;
+ return custom_suffix != NULL;
}
diff --git a/src/xz/suffix.h b/src/xz/suffix.h
index cb36dd61..135e9056 100644
--- a/src/xz/suffix.h
+++ b/src/xz/suffix.h
@@ -27,6 +27,7 @@ extern char *suffix_get_dest_name(const char *src_name);
/// and forgotten.
extern void suffix_set(const char *suffix);
+
/// \brief Check if a custom suffix has been set
///
/// Returns true if the internal tracking of the suffix string has been set