X-Git-Url: https://git.jsancho.org/?p=guile-irrlicht.git;a=blobdiff_plain;f=src%2Fprimitive-types.cpp;h=eb1d8a592f43dc53bd824e4175f9ad3ef0db6af1;hp=7f4db7f192f72421c6f0a0e3e06450d3b6767457;hb=357f279e004c6257a160205835c06c283d317ef7;hpb=384a8fb56d8500dc3551085191a39c9da70e221c diff --git a/src/primitive-types.cpp b/src/primitive-types.cpp index 7f4db7f..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_string (scm_symbol_to_string (primitive_type)); - 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; }