Opened 4 months ago

Closed 3 months ago

#26283 closed defect (fixed)

smartlist_len cast to double

Reported by: rl1987 Owned by:
Priority: Medium Milestone: Tor: 0.3.4.x-final
Component: Core Tor/Tor Version: Tor: unspecified
Severity: Normal Keywords: fast-fix
Cc: catalyst Actual Points:
Parent ID: #26196 Points:
Reviewer: asn Sponsor:

Description

When building with DEBUG_SMARTLIST:

src/or/routerlist.c:2767:45: warning: cast from function call of type 'int' to non-matching type 'double' [-Wbad-function-cast]
    return ((double)n_with_descs) / (double)smartlist_len(sl);
                                            ^~~~~~~~~~~~~~~~~
1 warning generated.
src/or/routerlist.c:2767:45: warning: cast from function call of type 'int' to non-matching type 'double' [-Wbad-function-cast]
    return ((double)n_with_descs) / (double)smartlist_len(sl);
                                            ^~~~~~~~~~~~~~~~~
1 warning generated.

Child Tickets

Change History (7)

comment:1 Changed 4 months ago by rl1987

Status: newneeds_review

comment:2 Changed 4 months ago by nickm

Keywords: fast-fix added
Milestone: Tor: 0.3.5.x-finalTor: 0.3.4.x-final

comment:3 Changed 4 months ago by dgoulet

Reviewer: ahf

comment:4 Changed 4 months ago by asn

Reviewer: ahfasn

Swapping 034 reviews with ahf since he is travelling.

comment:5 Changed 3 months ago by asn

Status: needs_reviewmerge_ready

I can verify that the patch resolves the warning when DEBUG_SMARTLIST is enabled.

The return value of the division should remain the same (a double), since the numerator of the division is a double.

LGTM.

comment:6 Changed 3 months ago by nickm

ok, merged! Let's see if any compilers dislike it. :)

comment:7 Changed 3 months ago by nickm

Resolution: fixed
Status: merge_readyclosed
Note: See TracTickets for help on using tickets.