Skip to content
  • Hans Breuer's avatar
    [warningectomy] implicit conversion from enumeration type DiaSvgLineDefaults · 9c6a0d88
    Hans Breuer authored
    Actually a design change: formerly we were relying on weak typing of enums,
    i.e. assigning values from the wrong enum to e.g. to type 'LineJoin'. Now
    *_DEFAULT variants are part of the main enum, e.g LineJoin and has to be
    handled explicitely on the consumer level, here mostly renderers.
    
    Removes the following warnings:
    
    dia_svg.c:71:56: warning: implicit conversion from enumeration type 'enum DiaSvgLineDefaults' to different enumeration type 'LineCaps' [-Wenum-conversion]
      gs->linecap = parent_style ? parent_style->linecap : DIA_SVG_LINECAPS_DEFAULT;
                  ~                                        ^~~~~~~~~~~~~~~~~~~~~~~~
    dia_svg.c:72:58: warning: implicit conversion from enumeration type 'enum DiaSvgLineDefaults' to different enumeration type 'LineJoin' [-Wenum-conversion]
      gs->linejoin = parent_style ? parent_style->linejoin : DIA_SVG_LINEJOIN_DEFAULT;
                   ~                                         ^~~~~~~~~~~~~~~~~~~~~~~~
    dia_svg.c:73:60: warning: implicit conversion from enumeration type 'enum DiaSvgLineDefaults' to different enumeration type 'LineStyle' [-Wenum-conversion]
      gs->linestyle = parent_style ? parent_style->linestyle : DIA_SVG_LINESTYLE_DEFAULT;
                    ~                                          ^~~~~~~~~~~~~~~~~~~~~~~~~
    dia_svg.c:484:19: warning: implicit conversion from enumeration type 'enum DiaSvgLineDefaults' to different enumeration type 'LineJoin' [-Wenum-conversion]
        s->linejoin = DIA_SVG_LINEJOIN_DEFAULT;
                    ~ ^~~~~~~~~~~~~~~~~~~~~~~~
    dia_svg.c:496:18: warning: implicit conversion from enumeration type 'enum DiaSvgLineDefaults' to different enumeration type 'LineCaps' [-Wenum-conversion]
        s->linecap = DIA_SVG_LINECAPS_DEFAULT;
                   ~ ^~~~~~~~~~~~~~~~~~~~~~~~
    dia_svg.c:694:17: warning: implicit conversion from enumeration type 'enum DiaSvgLineDefaults' to different enumeration type 'LineStyle' [-Wenum-conversion]
            s->linestyle = DIA_SVG_LINESTYLE_DEFAULT;
                         ~ ^~~~~~~~~~~~~~~~~~~~~~~~~
    shape_info.c:121:32: warning: comparison of constant -1 with expression of type 'Alignment' is always false [-Wtautological-constant-out-of-range-compare]
          if (el->text.s.alignment == -1)
              ~~~~~~~~~~~~~~~~~~~~ ^  ~~
    shape_info.c:911:2: warning: implicit conversion from enumeration type 'enum DiaSvgLineDefaults' to different enumeration type 'LineCaps' [-Wenum-conversion]
            DIA_SVG_LINECAPS_DEFAULT, DIA_SVG_LINEJOIN_DEFAULT, DIA_SVG_LINESTYLE_DEFAULT, 1.0
            ^~~~~~~~~~~~~~~~~~~~~~~~
    shape_info.c:911:28: warning: implicit conversion from enumeration type 'enum DiaSvgLineDefaults' to different enumeration type 'LineJoin' [-Wenum-conversion]
            DIA_SVG_LINECAPS_DEFAULT, DIA_SVG_LINEJOIN_DEFAULT, DIA_SVG_LINESTYLE_DEFAULT, 1.0
                                      ^~~~~~~~~~~~~~~~~~~~~~~~
    shape_info.c:911:54: warning: implicit conversion from enumeration type 'enum DiaSvgLineDefaults' to different enumeration type 'LineStyle' [-Wenum-conversion]
            DIA_SVG_LINECAPS_DEFAULT, DIA_SVG_LINEJOIN_DEFAULT, DIA_SVG_LINESTYLE_DEFAULT, 1.0
                                                                ^~~~~~~~~~~~~~~~~~~~~~~~~
    custom_object.c:926:26: warning: comparison of constant 'DIA_SVG_LINECAPS_DEFAULT' (20) with expression of type 'LineCaps' is always false [-Wtautological-constant-out-of-range-compare]
      if ((el->any.s.linecap == DIA_SVG_LINECAPS_DEFAULT && (*cur_caps) != LINECAPS_BUTT) ||
           ~~~~~~~~~~~~~~~~~ ^  ~~~~~~~~~~~~~~~~~~~~~~~~
    custom_object.c:928:39: warning: comparison of constant 'DIA_SVG_LINECAPS_DEFAULT' (20) with expression of type 'LineCaps' is always true [-Wtautological-constant-out-of-range-compare]
          (*cur_caps) = (el->any.s.linecap!=DIA_SVG_LINECAPS_DEFAULT) ?
                         ~~~~~~~~~~~~~~~~~^ ~~~~~~~~~~~~~~~~~~~~~~~~
    custom_object.c:932:26: warning: comparison of constant 'DIA_SVG_LINEJOIN_DEFAULT' (20) with expression of type 'LineJoin' is always false [-Wtautological-constant-out-of-range-compare]
      if ((el->any.s.linejoin==DIA_SVG_LINEJOIN_DEFAULT && (*cur_join)!=LINEJOIN_MITER) ||
           ~~~~~~~~~~~~~~~~~~^ ~~~~~~~~~~~~~~~~~~~~~~~~
    custom_object.c:934:38: warning: comparison of constant 'DIA_SVG_LINEJOIN_DEFAULT' (20) with expression of type 'LineJoin' is always true [-Wtautological-constant-out-of-range-compare]
        (*cur_join) = (el->any.s.linejoin!=DIA_SVG_LINEJOIN_DEFAULT) ?
                       ~~~~~~~~~~~~~~~~~~^ ~~~~~~~~~~~~~~~~~~~~~~~~
    custom_object.c:938:28: warning: comparison of constant 'DIA_SVG_LINESTYLE_DEFAULT' (20) with expression of type 'LineStyle' is always false [-Wtautological-constant-out-of-range-compare]
      if ((el->any.s.linestyle == DIA_SVG_LINESTYLE_DEFAULT &&
           ~~~~~~~~~~~~~~~~~~~ ^  ~~~~~~~~~~~~~~~~~~~~~~~~~
    custom_object.c:940:40: warning: comparison of constant 'DIA_SVG_LINESTYLE_DEFAULT' (20) with expression of type 'LineStyle' is always true [-Wtautological-constant-out-of-range-compare]
        (*cur_style) = (el->any.s.linestyle!=DIA_SVG_LINESTYLE_DEFAULT) ?
                        ~~~~~~~~~~~~~~~~~~~^ ~~~~~~~~~~~~~~~~~~~~~~~~~
    svg-import.c:468:25: warning: comparison of constant 'DIA_SVG_LINESTYLE_DEFAULT' (20) with expression of type 'LineStyle' is always true [-Wtautological-constant-out-of-range-compare]
          if (gs->linestyle != DIA_SVG_LINESTYLE_DEFAULT)
              ~~~~~~~~~~~~~ ^  ~~~~~~~~~~~~~~~~~~~~~~~~~
    svg-import.c:524:24: warning: comparison of constant 'DIA_SVG_LINEJOIN_DEFAULT' (20) with expression of type 'LineJoin' is always true [-Wtautological-constant-out-of-range-compare]
          if (gs->linejoin != DIA_SVG_LINEJOIN_DEFAULT)
              ~~~~~~~~~~~~ ^  ~~~~~~~~~~~~~~~~~~~~~~~~
    svg-import.c:530:23: warning: comparison of constant 'DIA_SVG_LINECAPS_DEFAULT' (20) with expression of type 'LineCaps' is always true [-Wtautological-constant-out-of-range-compare]
          if (gs->linecap != DIA_SVG_LINECAPS_DEFAULT)
              ~~~~~~~~~~~ ^  ~~~~~~~~~~~~~~~~~~~~~~~~
    9c6a0d88