From 84d0342cef7a1eb2c4ea10af84d3a608c003159a Mon Sep 17 00:00:00 2001 From: asuraven Date: Tue, 3 Nov 2020 17:22:14 +0300 Subject: [PATCH] 0031908: Draw Harness, TKTopTest - wavefront file path length is limited to 100 characters * Change file path variable in wavefront function from char[100] to TCollection_AsciiString --- src/MeshTest/MeshTest.cxx | 13 +++++++------ tests/demo/draw/bug31908 | 8 ++++++++ 2 files changed, 15 insertions(+), 6 deletions(-) create mode 100644 tests/demo/draw/bug31908 diff --git a/src/MeshTest/MeshTest.cxx b/src/MeshTest/MeshTest.cxx index d02cfcd917..80f41a3ab1 100644 --- a/src/MeshTest/MeshTest.cxx +++ b/src/MeshTest/MeshTest.cxx @@ -39,6 +39,7 @@ #include #include #include +#include #include #include #include @@ -788,17 +789,17 @@ static Standard_Integer wavefront(Draw_Interpretor&, Standard_Integer nbarg, con Standard_Integer n1, n2, n3; Standard_Integer k1, k2, k3; - char ffile[100]; + TCollection_AsciiString aFile; if (nbarg == 3) { - strcpy(ffile, argv[2]); - strcat(ffile, ".obj"); + aFile = argv[2]; + aFile += ".obj"; } - else strcpy(ffile, "wave.obj"); - FILE* outfile = fopen(ffile, "w"); + else aFile = "wave.obj"; + FILE* outfile = OSD_OpenFile(aFile.ToCString(), "w"); - fprintf(outfile, "%s %s\n%s %s\n\n", "# CASCADE ","MATRA DATAVISION", "#", ffile); + fprintf(outfile, "%s %s\n%s %s\n\n", "# CASCADE ","MATRA DATAVISION", "#", aFile.ToCString()); Standard_Integer nbNodes, totalnodes = 0, nbpolygons = 0; for (ex.Init(S, TopAbs_FACE); ex.More(); ex.Next()) { diff --git a/tests/demo/draw/bug31908 b/tests/demo/draw/bug31908 new file mode 100644 index 0000000000..217c5263ff --- /dev/null +++ b/tests/demo/draw/bug31908 @@ -0,0 +1,8 @@ +puts "==========" +puts "0031908: Draw Harness, TKTopTest - wavefront file path length is limited to 100 characters" +puts "==========" +puts "" +pload MODELING +box b 10 20 30 +wavefront b the_name_of_saved_with_wavefront_command_box_that_measures_10_20_30_and_has_length_of_its_name_longer_than_100_characters +puts "TEST COMPLETED"