File tree Expand file tree Collapse file tree 1 file changed +9
-7
lines changed Expand file tree Collapse file tree 1 file changed +9
-7
lines changed Original file line number Diff line number Diff line change @@ -1088,10 +1088,11 @@ void Identifier::_exportToWKT(WKTFormatter *formatter) const {
10881088 formatter->addQuotedString (l_code);
10891089 }
10901090 if (!l_version.empty ()) {
1091- try {
1092- (void )c_locale_stod (l_version);
1091+ bool isDouble = false ;
1092+ (void )c_locale_stod (l_version, isDouble);
1093+ if (isDouble) {
10931094 formatter->add (l_version);
1094- } catch ( const std::exception &) {
1095+ } else {
10951096 formatter->addQuotedString (l_version);
10961097 }
10971098 }
@@ -1140,16 +1141,17 @@ void Identifier::_exportToJSON(JSONFormatter *formatter) const {
11401141
11411142 if (!l_version.empty ()) {
11421143 writer->AddObjKey (" version" );
1143- try {
1144- const double dblVersion = c_locale_stod (l_version);
1144+ bool isDouble = false ;
1145+ const double dblVersion = c_locale_stod (l_version, isDouble);
1146+ if (isDouble) {
11451147 if (dblVersion >= std::numeric_limits<int >::min () &&
11461148 dblVersion <= std::numeric_limits<int >::max () &&
11471149 static_cast <int >(dblVersion) == dblVersion) {
11481150 writer->Add (static_cast <int >(dblVersion));
11491151 } else {
1150- writer->Add (dblVersion);
1152+ writer->Add (dblVersion, /* precision= */ 15 );
11511153 }
1152- } catch ( const std::exception &) {
1154+ } else {
11531155 writer->Add (l_version);
11541156 }
11551157 }
You can’t perform that action at this time.
0 commit comments