X-Git-Url: https://git.jsancho.org/?p=guile-irrlicht.git;a=blobdiff_plain;f=src%2Fprimitive-types.cpp;h=eb1d8a592f43dc53bd824e4175f9ad3ef0db6af1;hp=9704803ad49ad2319a50412274a232f6c4e6d963;hb=3bb58c2b45af12c0f9c9eac648e67ac6fa90e104;hpb=41a6ad96e81a8d8153c54877c4c12f61100677a9 diff --git a/src/primitive-types.cpp b/src/primitive-types.cpp index 9704803..eb1d8a5 100644 --- a/src/primitive-types.cpp +++ b/src/primitive-types.cpp @@ -28,54 +28,59 @@ using namespace irr; scene::E_PRIMITIVE_TYPE scm_to_primitive_type (SCM primitive_type) { - char* type = scm_to_utf8_stringn (scm_symbol_to_string (primitive_type), NULL); - if (!strcmp (type, "points")) + char* type_name = scm_to_utf8_string (scm_symbol_to_string (primitive_type)); + scene::E_PRIMITIVE_TYPE type; + + if (!strcmp (type_name, "points")) { - return scene::EPT_POINTS; + type = scene::EPT_POINTS; } - else if (!strcmp (type, "line-strip")) + else if (!strcmp (type_name, "line-strip")) { - return scene::EPT_LINE_STRIP; + type = scene::EPT_LINE_STRIP; } - else if (!strcmp (type, "line-loop")) + else if (!strcmp (type_name, "line-loop")) { - return scene::EPT_LINE_LOOP; + type = scene::EPT_LINE_LOOP; } - else if (!strcmp (type, "lines")) + else if (!strcmp (type_name, "lines")) { - return scene::EPT_LINES; + type = scene::EPT_LINES; } - else if (!strcmp (type, "triangle-strip")) + else if (!strcmp (type_name, "triangle-strip")) { - return scene::EPT_TRIANGLE_STRIP; + type = scene::EPT_TRIANGLE_STRIP; } - else if (!strcmp (type, "triangle-fan")) + else if (!strcmp (type_name, "triangle-fan")) { - return scene::EPT_TRIANGLE_FAN; + type = scene::EPT_TRIANGLE_FAN; } - else if (!strcmp (type, "triangles")) + else if (!strcmp (type_name, "triangles")) { - return scene::EPT_TRIANGLES; + type = scene::EPT_TRIANGLES; } - else if (!strcmp (type, "quad-strip")) + else if (!strcmp (type_name, "quad-strip")) { - return scene::EPT_QUAD_STRIP; + type = scene::EPT_QUAD_STRIP; } - else if (!strcmp (type, "quads")) + else if (!strcmp (type_name, "quads")) { - return scene::EPT_QUADS; + type = scene::EPT_QUADS; } - else if (!strcmp (type, "polygon")) + else if (!strcmp (type_name, "polygon")) { - return scene::EPT_POLYGON; + type = scene::EPT_POLYGON; } - else if (!strcmp (type, "point-sprites")) + else if (!strcmp (type_name, "point-sprites")) { - return scene::EPT_POINT_SPRITES; + type = scene::EPT_POINT_SPRITES; } else { scm_error (scm_arg_type_key, NULL, "Wrong primitive type: ~S", scm_list_1 (primitive_type), scm_list_1 (primitive_type)); } + + free (type_name); + return type; }