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.
This commit is contained in:
Lasse Collin 2023-01-24 00:05:38 +02:00 committed by Jia Tan
parent cc5aa9ab13
commit 683a3c7e2f
3 changed files with 5 additions and 4 deletions

View File

@ -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, // If raw format is used and a custom suffix is not provided,
// then only stdout mode can be used when compressing or decompressing. // then only stdout mode can be used when compressing or decompressing.
if (opt_format == FORMAT_RAW && suffix_is_set() && !opt_stdout && if (opt_format == FORMAT_RAW && !suffix_is_set() && !opt_stdout
(opt_mode == MODE_COMPRESS || && (opt_mode == MODE_COMPRESS
opt_mode == MODE_DECOMPRESS)) || opt_mode == MODE_DECOMPRESS))
message_fatal(_("With --format=raw, --suffix=.SUF is " message_fatal(_("With --format=raw, --suffix=.SUF is "
"required unless writing to stdout")); "required unless writing to stdout"));

View File

@ -397,5 +397,5 @@ suffix_set(const char *suffix)
extern bool extern bool
suffix_is_set(void) suffix_is_set(void)
{ {
return custom_suffix == NULL; return custom_suffix != NULL;
} }

View File

@ -27,6 +27,7 @@ extern char *suffix_get_dest_name(const char *src_name);
/// and forgotten. /// and forgotten.
extern void suffix_set(const char *suffix); extern void suffix_set(const char *suffix);
/// \brief Check if a custom suffix has been set /// \brief Check if a custom suffix has been set
/// ///
/// Returns true if the internal tracking of the suffix string has been set /// Returns true if the internal tracking of the suffix string has been set