]> git.jsancho.org Git - guile-irrlicht.git/blobdiff - src/file-archive.cpp
Some doc
[guile-irrlicht.git] / src / file-archive.cpp
index 10d3dbde2162924920f2ea92efd442c5f54a95da..751da745e95647230d3fc074c019e53a4b75d33c 100644 (file)
 #include <libguile.h>
 #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;
 }