X-Git-Url: https://git.jsancho.org/?p=guile-irrlicht.git;a=blobdiff_plain;f=src%2Ffile-archive.cpp;h=751da745e95647230d3fc074c019e53a4b75d33c;hp=10d3dbde2162924920f2ea92efd442c5f54a95da;hb=3bb58c2b45af12c0f9c9eac648e67ac6fa90e104;hpb=cb00a4ce59df131e82f28deb4160015baae1fabe diff --git a/src/file-archive.cpp b/src/file-archive.cpp index 10d3dbd..751da74 100644 --- a/src/file-archive.cpp +++ b/src/file-archive.cpp @@ -23,49 +23,52 @@ #include #include "file-archive.h" - using namespace irr; - io::E_FILE_ARCHIVE_TYPE scm_to_file_archive_type (SCM file_archive_type) { - char* type = scm_to_utf8_stringn (scm_symbol_to_string (file_archive_type), NULL); - if (!strcmp (type, "zip")) + char* type_name = scm_to_utf8_string (scm_symbol_to_string (file_archive_type)); + io::E_FILE_ARCHIVE_TYPE type; + + if (!strcmp (type_name, "zip")) { - return io::EFAT_ZIP; + type = io::EFAT_ZIP; } - else if (!strcmp (type, "gzip")) + else if (!strcmp (type_name, "gzip")) { - return io::EFAT_GZIP; + type = io::EFAT_GZIP; } - else if (!strcmp (type, "folder")) + else if (!strcmp (type_name, "folder")) { - return io::EFAT_FOLDER; + type = io::EFAT_FOLDER; } - else if (!strcmp (type, "pak")) + else if (!strcmp (type_name, "pak")) { - return io::EFAT_PAK; + type = io::EFAT_PAK; } - else if (!strcmp (type, "npk")) + else if (!strcmp (type_name, "npk")) { - return io::EFAT_NPK; + type = io::EFAT_NPK; } - else if (!strcmp (type, "tar")) + else if (!strcmp (type_name, "tar")) { - return io::EFAT_TAR; + type = io::EFAT_TAR; } - else if (!strcmp (type, "wad")) + else if (!strcmp (type_name, "wad")) { - return io::EFAT_WAD; + type = io::EFAT_WAD; } - else if (!strcmp (type, "unknown")) + else if (!strcmp (type_name, "unknown")) { - return io::EFAT_UNKNOWN; + type = io::EFAT_UNKNOWN; } else { scm_error (scm_arg_type_key, NULL, "Wrong file archive type: ~S", scm_list_1 (file_archive_type), scm_list_1 (file_archive_type)); } + + free (type_name); + return type; }