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 {
1088
1088
formatter->addQuotedString (l_code);
1089
1089
}
1090
1090
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) {
1093
1094
formatter->add (l_version);
1094
- } catch ( const std::exception &) {
1095
+ } else {
1095
1096
formatter->addQuotedString (l_version);
1096
1097
}
1097
1098
}
@@ -1140,16 +1141,17 @@ void Identifier::_exportToJSON(JSONFormatter *formatter) const {
1140
1141
1141
1142
if (!l_version.empty ()) {
1142
1143
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) {
1145
1147
if (dblVersion >= std::numeric_limits<int >::min () &&
1146
1148
dblVersion <= std::numeric_limits<int >::max () &&
1147
1149
static_cast <int >(dblVersion) == dblVersion) {
1148
1150
writer->Add (static_cast <int >(dblVersion));
1149
1151
} else {
1150
- writer->Add (dblVersion);
1152
+ writer->Add (dblVersion, /* precision= */ 15 );
1151
1153
}
1152
- } catch ( const std::exception &) {
1154
+ } else {
1153
1155
writer->Add (l_version);
1154
1156
}
1155
1157
}
You can’t perform that action at this time.
0 commit comments