Skip to content

Time comparison errors in DestAdvert.cpp #13

@rmccourt

Description

@rmccourt

I got a pair of related errors while trying to compile onto the Raspberry Pi:

/home/rmccourt/LL-DLEP/DestAdvert.cpp:378:27: error: comparison of integer expressions of different signedness: ‘time_t’ {aka ‘long int’} and ‘unsigned int’ [-Werror=sign-compare]
             if (entry_age >= hold_interval)
                 ~~~~~~~~~~^~~~~~~~~~~~~~~~
/home/rmccourt/LL-DLEP/DestAdvert.cpp:390:27: error: comparison of integer expressions of different signedness: ‘time_t’ {aka ‘long int’} and ‘unsigned int’ [-Werror=sign-compare]
             if (entry_age >= expire_count * entry.info.reportInterval)
                 ~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

I got it to compile by casting the results to time_t:

if (entry_age >= (time_t) hold_interval)
and
if (entry_age >= (time_t) (expire_count * entry.info.reportInterval))

Not positive that it's the perfect fix, but figured I'd flag it for someone who's more familiar with the code to look at. Not really sure if/how to submit this as a change for review.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions