~valavanisalex/ubuntu/precise/inkscape/fix-943984

« back to all changes in this revision

Viewing changes to inkscape-0.47pre1/src/version.cpp

  • Committer: Bazaar Package Importer
  • Author(s): Bryce Harrington
  • Date: 2009-07-02 17:09:45 UTC
  • mfrom: (1.1.9 upstream)
  • Revision ID: james.westby@ubuntu.com-20090702170945-nn6d6zswovbwju1t
Tags: 0.47~pre1-0ubuntu1
* New upstream release.
  - Don't constrain maximization on small resolution devices (pre0)
    (LP: #348842)
  - Fixes segfault on startup (pre0)
    (LP: #391149)

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#define __VERSION_C__
 
2
 
 
3
/*
 
4
 * Versions
 
5
 *
 
6
 * Authors:
 
7
 *   MenTaLguY <mental@rydia.net>
 
8
 *
 
9
 * Copyright (C) 2003 MenTaLguY
 
10
 *
 
11
 * Released under GNU GPL, read the file 'COPYING' for more information
 
12
 */
 
13
 
 
14
#include <stdio.h>
 
15
#include <glib/gstrfuncs.h>
 
16
#include "version.h"
 
17
 
 
18
gboolean sp_version_from_string(const gchar *string, Inkscape::Version *version)
 
19
{
 
20
    if (!string) {
 
21
        return FALSE;
 
22
    }
 
23
 
 
24
    version->major = 0;
 
25
    version->minor = 0;
 
26
 
 
27
    return sscanf((const char *)string, "%u.%u",
 
28
                  &version->major, &version->minor) ||
 
29
        sscanf((const char *)string, "%u", &version->major);
 
30
}
 
31
 
 
32
gchar *sp_version_to_string(Inkscape::Version version)
 
33
{
 
34
    return g_strdup_printf("%u.%u", version.major, version.minor);
 
35
}
 
36
 
 
37
gboolean sp_version_inside_range(Inkscape::Version version,
 
38
                                 unsigned major_min, unsigned minor_min,
 
39
                                 unsigned major_max, unsigned minor_max)
 
40
{
 
41
    if ( version.major < major_min || version.major > major_max ) {
 
42
        return FALSE;
 
43
    } else if ( version.major == major_min &&
 
44
                version.minor <= minor_min )
 
45
    {
 
46
        return FALSE;
 
47
    } else if ( version.major == major_max &&
 
48
                version.minor >= minor_max )
 
49
    {
 
50
        return FALSE;
 
51
    } else {
 
52
        return TRUE;
 
53
    }
 
54
}
 
55
 
 
56
/*
 
57
  Local Variables:
 
58
  mode:c++
 
59
  c-file-style:"stroustrup"
 
60
  c-file-offsets:((innamespace . 0)(inline-open . 0)(case-label . +))
 
61
  indent-tabs-mode:nil
 
62
  fill-column:99
 
63
  End:
 
64
*/
 
65
// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4 :