Skip to content

Commit a2e43de

Browse files
committed
Merge branch '362-plantage-brutale-en-cas-de-probleme-de-format-dans-le-cor' into 'main'
Fix crash reading COR if missing code, point name as digits only and sigmas See merge request travaux-speciaux-sgn/comp3d_cpp!54
2 parents e62847d + bdc96ba commit a2e43de

4 files changed

Lines changed: 8 additions & 13 deletions

File tree

src/point.cpp

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -381,13 +381,6 @@ bool Point::read_point(std::string line, bool fromNEW)
381381
}else if (!(iss >> _sigmas_init[2]))
382382
{
383383
eta_xi_given=true;
384-
if (!fromNEW)
385-
{
386-
//it may not be a problem, just that there is only eta and xi, not sigma x y z
387-
//Project::theInfo()->msg(INFO_COR,getFileDepth(),QT_TRANSLATE_NOOP("QObject","In %s:%d: Can't convert point sigma_z."),
388-
// getFileName().c_str(),lineNumber);
389-
ok=false;
390-
}
391384
}else if (ok)
392385
sigmas_given=true;
393386
}
@@ -411,7 +404,6 @@ bool Point::read_point(std::string line, bool fromNEW)
411404
_xi = _sigmas_init[1];
412405
_sigmas_init[0] = 0;
413406
_sigmas_init[1] = 0;
414-
ok=true;
415407
}
416408

417409
if (eta_xi_given)

tests/data/errors/ex.cor

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,3 +7,6 @@
77
1 a 0 11 0 0.0001 0.0001 0.0001
88
0 b 0 0 0 0.001 0.001 0.001
99

10+
91E251 946171 6847065 0 0 0 0 * missing code
11+
912512 946171 6847065 0 0 0 0 * missing code and point name as digits
12+

tests/data/errors/ex_ref.comp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ data=
55
"COMP3D_LICENSE" : "Provided with absolutely no warranty, under GPLv3 license",
66
"COMP3D_OPTIONS" : "QT RES ",
77
"COMP3D_REPO" : "https://github.com/IGNF/Comp3D",
8-
"COMP3D_VERSION" : "COMP3D v5.24dev-PROJ 8.2.1-linux",
8+
"COMP3D_VERSION" : "COMP3D v5.24dev-PROJ 9.4.0-linux",
99
"all_data_files" :
1010
{
1111
"0" : "ex.cor",
@@ -47,16 +47,16 @@ data=
4747
"min" : 0.51882011574030873
4848
},
4949
"compensation_done" : true,
50-
"computation_duration" : "00:00:00.001913",
51-
"computation_start" : "2024-Oct-25 14:28:51.134386",
50+
"computation_duration" : "00:00:00.001454",
51+
"computation_start" : "2025-Nov-03 10:31:57.953606",
5252
"internal_constraints" : false,
5353
"internal_constraints_obs" : [],
5454
"interrupted" : false,
5555
"inverted_matrix" : true,
5656
"kernel" : null,
5757
"messages_computation" : "",
5858
"messages_read_config" : "",
59-
"messages_read_data" : "Reading COR...<br/>\nRead file ex.cor...<br/>\n&nbsp;&nbsp;&nbsp;&nbsp;Read file toto.cor...<br/>\n<font color=#FF8000>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;At line 1: \"@toto.cor\" => Can't open file \"./data/errors/toto.cor\".</font><br/>\n<font color=#FF8000>&nbsp;&nbsp;&nbsp;&nbsp;In ex.cor:2: Wrong format in: 1ere part * oubli commentaire</font><br/>\n<font color=#FF8000>&nbsp;&nbsp;&nbsp;&nbsp;In ex.cor:3: Wrong format in: 1 S1 10 20 0.01 0.01 * manque un champ</font><br/>\n<font color=#FF8000>&nbsp;&nbsp;&nbsp;&nbsp;In ex.cor:5: Unknown point code 56.</font><br/>\n<font color=#FF8000>&nbsp;&nbsp;&nbsp;&nbsp;In ex.cor:5: Error reading line.</font><br/>\nReading OBS...<br/>\nRead file ex.obs...<br/>\n<font color=#FF8000>&nbsp;&nbsp;&nbsp;&nbsp;Warning: try to create a new hz station on point b without opening.</font><br/>\n<font color=#FF8000>&nbsp;&nbsp;&nbsp;&nbsp;In ex.obs:8: Wrong format in: 6 b a 0.001 0 0 0 *champ mesure manquant</font><br/>\n<font color=#FF8000>&nbsp;&nbsp;&nbsp;&nbsp;In ex.obs:9: 10 b a 100.001 0.001 0 0 0 *code inexistant => Impossible to determine observation type!</font><br/>\n<font color=#FF8000>&nbsp;&nbsp;&nbsp;&nbsp;In ex.obs:11: Wrong format in: 6 b a 100.001 *manque 4 champs</font><br/>\n<font color=#FF8000>&nbsp;&nbsp;&nbsp;&nbsp;In ex.obs:14: Wrong format in: 6 b a 100.001 0.001000 0 0 *manque 1 champ</font><br/>\n<font color=#FF8000>&nbsp;&nbsp;&nbsp;&nbsp;In ex.obs:19: 74563 b a 10.002 0.001000 0 0 0 *code inexistant => Impossible to determine observation type!</font><br/>\n&nbsp;&nbsp;&nbsp;&nbsp;Read file bilout.obs...<br/>\n<font color=#FF8000>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;At line 22: \"@bilout.obs\" => Can't open file \"./data/errors/bilout.obs\".</font><br/>\nPoints setting...<br/>\nRead data finished.<br/>\nAll points are initialized.<br/>\nVertical deflection not used.<br/>\n",
59+
"messages_read_data" : "Reading COR...<br/>\nRead file ex.cor...<br/>\n&nbsp;&nbsp;&nbsp;&nbsp;Read file toto.cor...<br/>\n<font color=#FF8000>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;At line 1: \"@toto.cor\" => Can't open file \"./data/errors/toto.cor\".</font><br/>\n<font color=#FF8000>&nbsp;&nbsp;&nbsp;&nbsp;In ex.cor:2: Wrong format in: 1ere part * oubli commentaire</font><br/>\n<font color=#FF8000>&nbsp;&nbsp;&nbsp;&nbsp;In ex.cor:3: Wrong format in: 1 S1 10 20 0.01 0.01 * manque un champ</font><br/>\n<font color=#FF8000>&nbsp;&nbsp;&nbsp;&nbsp;In ex.cor:5: Unknown point code 56.</font><br/>\n<font color=#FF8000>&nbsp;&nbsp;&nbsp;&nbsp;In ex.cor:5: Error reading line.</font><br/>\n<font color=#FF8000>&nbsp;&nbsp;&nbsp;&nbsp;In ex.cor:10: Wrong format in: \t91E251\t946171\t6847065\t0\t0\t0\t0\t* missing code</font><br/>\n<font color=#FF8000>&nbsp;&nbsp;&nbsp;&nbsp;In ex.cor:11: Unknown point code 912512.</font><br/>\n<font color=#FF8000>&nbsp;&nbsp;&nbsp;&nbsp;In ex.cor:11: Error reading line.</font><br/>\nReading OBS...<br/>\nRead file ex.obs...<br/>\n<font color=#FF8000>&nbsp;&nbsp;&nbsp;&nbsp;Warning: try to create a new hz station on point b without opening.</font><br/>\n<font color=#FF8000>&nbsp;&nbsp;&nbsp;&nbsp;In ex.obs:8: Wrong format in: 6 b a 0.001 0 0 0 *champ mesure manquant</font><br/>\n<font color=#FF8000>&nbsp;&nbsp;&nbsp;&nbsp;In ex.obs:9: 10 b a 100.001 0.001 0 0 0 *code inexistant => Impossible to determine observation type!</font><br/>\n<font color=#FF8000>&nbsp;&nbsp;&nbsp;&nbsp;In ex.obs:11: Wrong format in: 6 b a 100.001 *manque 4 champs</font><br/>\n<font color=#FF8000>&nbsp;&nbsp;&nbsp;&nbsp;In ex.obs:14: Wrong format in: 6 b a 100.001 0.001000 0 0 *manque 1 champ</font><br/>\n<font color=#FF8000>&nbsp;&nbsp;&nbsp;&nbsp;In ex.obs:19: 74563 b a 10.002 0.001000 0 0 0 *code inexistant => Impossible to determine observation type!</font><br/>\n&nbsp;&nbsp;&nbsp;&nbsp;Read file bilout.obs...<br/>\n<font color=#FF8000>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;At line 22: \"@bilout.obs\" => Can't open file \"./data/errors/bilout.obs\".</font><br/>\nPoints setting...<br/>\nRead data finished.<br/>\nAll points are initialized.<br/>\nVertical deflection not used.<br/>\n",
6060
"messages_set_least_squares" : "",
6161
"nbr_active_obs" : 11,
6262
"nbr_all_obs" : 12,

tests/tests_nonreg.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -155,7 +155,7 @@ void Tests_NonReg::test_errors()
155155
{
156156
std::cout<<"\nPrepare test_errors"<<std::endl;
157157
std::string refFile="./data/errors/ex_ref.comp";
158-
std::string refMD5="9712a25536b768be3d9efb5005a18850";
158+
std::string refMD5="b44ca40a2137697a10b5c44888ce6dde";
159159

160160
test_template(refFile, refMD5,false);
161161
}

0 commit comments

Comments
 (0)