From 8b4adb092b71a251c3a279dd98d05da4e01928af Mon Sep 17 00:00:00 2001 From: Phuntsok Drak-pa Date: Sun, 15 Apr 2018 21:15:07 +0200 Subject: [PATCH] Minor code style optimization --- src/compress.cc | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/src/compress.cc b/src/compress.cc index e4f2f17..a41a177 100644 --- a/src/compress.cc +++ b/src/compress.cc @@ -76,14 +76,17 @@ void compress(const std::string &t_in_file, const char *t_out_file) { std::ifstream input_file{t_in_file}; // Fichier de sortie - FILE *out = nullptr; - if (t_out_file) { - out = fopen(t_out_file, "wb"); - } else { - std::string out_name{t_in_file}; - out_name.append(".lzw"); - out = fopen(out_name.c_str(), "wb"); - } + // FILE *out = nullptr; + // if (t_out_file) { + // out = fopen(t_out_file, "wb"); + // } else { + // std::string out_name{t_in_file}; + // out_name.append(".lzw"); + // out = fopen(out_name.c_str(), "wb"); + // } + FILE *out = (t_out_file) + ? fopen(t_out_file, "wb") + : fopen(std::string{t_out_file, ".lzw"}.c_str(), "wb"); input_file.seekg(0, std::ios::end); // string contenant le fichier d’entrée