Opened 5 years ago
Closed 5 years ago
#1355 closed defect/bug (fixed)
CID 200497: Incorrect expression (UNINTENDED_INTEGER_DIVISION)
Reported by: | kazer | Owned by: | KaZeR |
---|---|---|---|
Priority: | major | Milestone: | version 0.5.2 |
Component: | core | Version: | git master |
Severity: | normal | Keywords: | |
Cc: |
Description
Reported by coverity, following the merge of https://github.com/navit-gps/navit/pull/359
** CID 200497: Incorrect expression (UNINTENDED_INTEGER_DIVISION) /navit/gui/gtk/gui_gtk_statusbar.c: 166 in statusbar_route_update() ________________________________________________________________________________________________________ *** CID 200497: Incorrect expression (UNINTENDED_INTEGER_DIVISION) /navit/gui/gtk/gui_gtk_statusbar.c: 166 in statusbar_route_update() 160 sprintf(this->gps_text,"GPS:%s %02d/%02d HD:%02.2f %s %4.0f%s %3.0f%-2s %3.1f%s", 161 status_fix2str(status), 162 sats, qual, hdop, buffer, 163 imperial ? height * FEET_PER_METER : height, 164 imperial == TRUE ? "\'" : "m", 165 direction, dir, >>> CID 200497: Incorrect expression (UNINTENDED_INTEGER_DIVISION) >>> Dividing integer expressions "1609" and "1000", and then converting the integer quotient to type "double". Any remainder, or fractional part of the quotient, is ignored. 166 imperial == TRUE ? speed / (METERS_PER_MILE / 1000) : speed, /* hard-coded. Ugly */ 167 imperial == TRUE ? " mph" : "km/h" 168 ); 169 170 gtk_label_set_text(GTK_LABEL(this->gps), this->gps_text); 171 }
Change History (3)
comment:1 Changed 5 years ago by wiki.navit-project.org/index.php/user:charles
comment:2 Changed 5 years ago by http://wiki.navit-project.org/index.php/user:jkoan
- Milestone changed from version 0.5.1 to version 0.5.2
This ticket was pushed back in order to bring 0.5.1 out soon.
comment:3 Changed 5 years ago by wiki.navit-project.org/index.php/user:aerostitch
- Resolution set to fixed
- Status changed from new to closed
From Charles Curley in https://github.com/aerostitch/testnavit/issues/291#issuecomment-385210356:
Since 0.5.1 is out, I think you can bring this issue back, and see if you still get the complaint. The relevant code has changed. If it is fixed, you can close this.
Note: See
TracTickets for help on using
tickets.
Probably fixed in branch fixImperialAgain. See pull request fix:gtk:Fix imperial factors. Again.