@@ -531,28 +531,28 @@ inline std::string glob_to_regex(std::string val) {
531531// File type detection
532532// ============================================================
533533
534- enum class file_type_e { Plain, Gzip, Bzip2, Xz, Zstd };
534+ enum class file_type_e { PLAIN , GZIP , BZIP2 , XZ , ZSTD };
535535
536536inline file_type_e detect_file_type (const std::string& path) {
537537 std::ifstream file (path, std::ios::binary);
538538 if (!file)
539- throw std::runtime_error (" Cannot open file for detection " );
539+ throw std::runtime_error (" cannot open file" );
540540
541541 unsigned char magic[6 ] = {0 };
542542 file.read (reinterpret_cast <char *>(magic), sizeof (magic));
543543
544544 if (magic[0 ] == 0x1F && magic[1 ] == 0x8B )
545- return file_type_e::Gzip ;
545+ return file_type_e::GZIP ;
546546
547547 if (magic[0 ] == 0x42 && magic[1 ] == 0x5A && magic[2 ] == 0x68 )
548- return file_type_e::Bzip2 ;
548+ return file_type_e::BZIP2 ;
549549
550550 if (magic[0 ] == 0xFD && magic[1 ] == 0x37 && magic[2 ] == 0x7A && magic[3 ] == 0x58 && magic[4 ] == 0x5A && magic[5 ] == 0x00 )
551- return file_type_e::Xz ;
551+ return file_type_e::XZ ;
552552
553553 if (magic[0 ] == 0x28 && magic[1 ] == 0xB5 && magic[2 ] == 0x2F && magic[3 ] == 0xFD )
554- return file_type_e::Zstd ;
555- return file_type_e::Plain ;
554+ return file_type_e::ZSTD ;
555+ return file_type_e::PLAIN ;
556556}
557557
558558} // namespace util
0 commit comments