aboutsummaryrefslogtreecommitdiff
path: root/src/iso19111/factory.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/iso19111/factory.cpp')
-rw-r--r--src/iso19111/factory.cpp12
1 files changed, 8 insertions, 4 deletions
diff --git a/src/iso19111/factory.cpp b/src/iso19111/factory.cpp
index 14421022..e42ed89f 100644
--- a/src/iso19111/factory.cpp
+++ b/src/iso19111/factory.cpp
@@ -259,7 +259,7 @@ struct DatabaseContext::Private {
static void getFromCache(LRUCacheOfObjects &cache, const std::string &code,
util::BaseObjectPtr &obj);
- void closeDB();
+ void closeDB() noexcept;
// cppcheck-suppress functionStatic
void registerFunctions();
@@ -295,7 +295,7 @@ DatabaseContext::Private::~Private() {
// ---------------------------------------------------------------------------
-void DatabaseContext::Private::closeDB() {
+void DatabaseContext::Private::closeDB() noexcept {
if (detach_) {
// Workaround a bug visible in SQLite 3.8.1 and 3.8.2 that causes
@@ -309,7 +309,10 @@ void DatabaseContext::Private::closeDB() {
// https://github.com/mackyle/sqlite/commit/ccf328c4318eacedab9ed08c404bc4f402dcad19
// also seemed to hide the issue.
// Detaching a database hides the issue, not sure if it is by chance...
- run("DETACH DATABASE db_0");
+ try {
+ run("DETACH DATABASE db_0");
+ } catch (...) {
+ }
detach_ = false;
}
@@ -1615,7 +1618,8 @@ static double normalizeMeasure(const std::string &uom_code,
assert(seconds.size() == precision - 2);
normalized_value =
(normalized_value < 0 ? -1.0 : 1.0) *
- (int(std::fabs(normalized_value)) + c_locale_stod(minutes) / 60. +
+ (std::floor(std::fabs(normalized_value)) +
+ c_locale_stod(minutes) / 60. +
(c_locale_stod(seconds) / std::pow(10, seconds.size() - 2)) /
3600.);
normalized_uom_code = common::UnitOfMeasure::DEGREE.code();