From 8dfc25432f0c295a80b419206f48da043054dcd3 Mon Sep 17 00:00:00 2001 From: Kris De Gussem Date: Sat, 22 Oct 2011 18:19:13 +0200 Subject: cppcheck: variable initialisation / fix possible memory leak (bzr r10688) --- src/version.h | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'src/version.h') diff --git a/src/version.h b/src/version.h index c62063123..faa8c38b2 100644 --- a/src/version.h +++ b/src/version.h @@ -17,7 +17,10 @@ namespace Inkscape { struct Version { - Version() {} + Version() { + major = 0; + minor = 0; + } Version(unsigned mj, unsigned mn) { // somebody pollutes our namespace with major() and minor() // macros, so we can't use new-style initializers -- cgit v1.2.3 From f12861c744aff474afdaa457781008cbb995113f Mon Sep 17 00:00:00 2001 From: "Jon A. Cruz" Date: Sun, 23 Oct 2011 02:03:12 -0700 Subject: Cleanup constructors and initialization. Removed unused macro. (bzr r10693) --- src/version.h | 82 +++++++++++++++++++++++++++++++++-------------------------- 1 file changed, 46 insertions(+), 36 deletions(-) (limited to 'src/version.h') diff --git a/src/version.h b/src/version.h index faa8c38b2..d90d27772 100644 --- a/src/version.h +++ b/src/version.h @@ -1,6 +1,7 @@ /* * Authors: * MenTaLguY + * Jon A. Cruz * * Copyright (C) 2003 MenTaLguY * @@ -16,45 +17,54 @@ namespace Inkscape { -struct Version { - Version() { - major = 0; - minor = 0; - } - Version(unsigned mj, unsigned mn) { - // somebody pollutes our namespace with major() and minor() - // macros, so we can't use new-style initializers - major = mj; - minor = mn; - } - - unsigned major; - unsigned minor; - - bool operator>(Version const &other) const { - return major > other.major || - ( major == other.major && minor > other.minor ); - } - bool operator==(Version const &other) const { - return major == other.major && minor == other.minor; - } - bool operator!=(Version const &other) const { - return major != other.major || minor != other.minor; - } - bool operator<(Version const &other) const { - return major < other.major || - ( major == other.major && minor < other.minor ); - } +class Version { +public: + + Version() : _major(0), _minor(0) {} + + // Note: somebody pollutes our namespace with major() and minor() + Version(unsigned mj, unsigned mn) : _major(mj), _minor(mn) {} + + bool operator>(Version const &other) const { + return _major > other._major || + ( _major == other._major && _minor > other._minor ); + } + + bool operator==(Version const &other) const { + return _major == other._major && _minor == other._minor; + } + + bool operator!=(Version const &other) const { + return _major != other._major || _minor != other._minor; + } + + bool operator<(Version const &other) const { + return _major < other._major || + ( _major == other._major && _minor < other._minor ); + } + + unsigned int _major; + unsigned int _minor; }; } -#define SP_VERSION_IS_ZERO (v) (!(v).major && !(v).minor) +gboolean sp_version_from_string(const gchar *string, Inkscape::Version *version); -gboolean sp_version_from_string (const gchar *string, Inkscape::Version *version); -gchar *sp_version_to_string (Inkscape::Version version); -gboolean sp_version_inside_range (Inkscape::Version version, - unsigned major_min, unsigned minor_min, - unsigned major_max, unsigned minor_max); +gchar *sp_version_to_string(Inkscape::Version version); -#endif +gboolean sp_version_inside_range(Inkscape::Version version, + unsigned major_min, unsigned minor_min, + unsigned major_max, unsigned minor_max); + +#endif // SEEN_INKSCAPE_VERSION_H +/* + Local Variables: + mode:c++ + c-file-style:"stroustrup" + c-file-offsets:((innamespace . 0)(inline-open . 0)) + indent-tabs-mode:nil + fill-column:75 + End: +*/ +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4 : -- cgit v1.2.3 From 4e51446f417ad82d2cdac758d0c5ce908ff88038 Mon Sep 17 00:00:00 2001 From: Alex Valavanis Date: Thu, 8 Dec 2011 11:53:54 +0000 Subject: Switch to top-level glib headers. Thanks to DimStar for patch Fixed bugs: - https://launchpad.net/bugs/898538 (bzr r10762) --- src/version.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/version.h') diff --git a/src/version.h b/src/version.h index d90d27772..26fbc11a3 100644 --- a/src/version.h +++ b/src/version.h @@ -11,7 +11,7 @@ #ifndef SEEN_INKSCAPE_VERSION_H #define SEEN_INKSCAPE_VERSION_H -#include +#include #define SVG_VERSION "1.1" -- cgit v1.2.3