Ticket #973 (closed task: fixed)

Opened 3 years ago

Last modified 3 years ago

[API] signed/unsigned cleanup

Reported by: dgollub Owned by: bricks
Priority: high Milestone: OpenSync 0.40
Component: OpenSync Version: 0.38
Severity: normal Keywords:
Cc:

Description

Lots of OpenSync? interface have:

  • int osync_xyz_num_xy(...)
  • OSyncXyz *osync_xyz_nth_xy(OSyncYyy *, int nth)

.. which need to get changed to use unsigned int.
Internally most of them use OSyncList or GList - nth and length interface of those lists are signed.

old interface patternnew interface pattern
int osync_xyz_num_xy(...)unsigned int osync_xyz_num_xy()
OSyncYyy *osync_xyz_nth_xy(OSyncZzz *, int nth)OSyncYyy *osync_xyz_nth_xy(OSyncZzz *, usigned int nth)

When using GCC this could also help to find more internally wrong use, following CFLAGS might help (man-page gcc(1)):

       -Wsign-compare
           Warn when a comparison between signed and unsigned values could
           produce an incorrect result when the signed value is converted to
           unsigned.  This warning is also enabled by -Wextra; to get the
           other warnings of -Wextra without this warning, use -Wextra
           -Wno-sign-compare.

       -Wsign-conversion
           Warn for implicit conversions that may change the sign of an
           integer value, like assigning a signed integer expression to an
           unsigned integer variable. An explicit cast silences the warning.
           In C, this option is enabled also by -Wconversion.

Change History

comment:1 Changed 3 years ago by bricks

  • Owner changed from dgollub to bricks

comment:2 Changed 3 years ago by bricks

  • Status changed from new to assigned

comment:3 Changed 3 years ago by bricks

  • Status changed from assigned to closed
  • Resolution set to fixed

should be fixed in r5287

Note: See TracTickets for help on using tickets.