X-Git-Url: https://git.jsancho.org/?p=guile-irrlicht.git;a=blobdiff_plain;f=src%2Ffile-archive.cpp;h=751da745e95647230d3fc074c019e53a4b75d33c;hp=ffaac4285265080c377e30cf654db6477f8601c5;hb=357f279e004c6257a160205835c06c283d317ef7;hpb=384a8fb56d8500dc3551085191a39c9da70e221c diff --git a/src/file-archive.cpp b/src/file-archive.cpp index ffaac42..751da74 100644 --- a/src/file-archive.cpp +++ b/src/file-archive.cpp @@ -28,42 +28,47 @@ using namespace irr; io::E_FILE_ARCHIVE_TYPE scm_to_file_archive_type (SCM file_archive_type) { - char* type = scm_to_utf8_string (scm_symbol_to_string (file_archive_type)); - 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; }