diff options
| author | Michael Soegtrop <MSoegtrop@yahoo.de> | 2016-06-12 10:52:33 +0000 |
|---|---|---|
| committer | Michael Soegtrop <MSoegtrop@yahoo.de> | 2016-06-12 10:52:33 +0000 |
| commit | 013ba80c5b0115dbb0f6da01e1f42806a4037eb8 (patch) | |
| tree | fe8d764a8e808c2084df8ace149d472109f3ae25 /src/version.cpp | |
| parent | Fixed Bool LPE review issues (diff) | |
| parent | Optionally sort attributes and properties into a canonical order. (diff) | |
| download | inkscape-013ba80c5b0115dbb0f6da01e1f42806a4037eb8.tar.gz inkscape-013ba80c5b0115dbb0f6da01e1f42806a4037eb8.zip | |
updated to latest trunk
(bzr r14876.2.3)
Diffstat (limited to 'src/version.cpp')
| -rw-r--r-- | src/version.cpp | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/src/version.cpp b/src/version.cpp index abe855ee7..7610cd8e7 100644 --- a/src/version.cpp +++ b/src/version.cpp @@ -21,28 +21,36 @@ bool sp_version_from_string(const char *string, Inkscape::Version *version) if (!string) { return false; } - + try { std::stringstream ss; + + // Throw exception if error. + ss.exceptions(std::ios::failbit | std::ios::badbit); ss << string; ss >> version->_major; char tmp=0; ss >> tmp; ss >>version->_minor; + + // Don't throw exception if failbit gets set (empty string OK). + ss.exceptions(std::ios::goodbit); + getline(ss, version->_tail); return true; } catch(...) { version->_major = 0; version->_minor = 0; + version->_tail.clear(); return false; } } char *sp_version_to_string(Inkscape::Version version) { - return g_strdup_printf("%u.%u", version._major, version._minor); + return g_strdup_printf("%u.%u%s", version._major, version._minor, version._tail.c_str()); } bool sp_version_inside_range(Inkscape::Version version, |
