Opened 7 weeks ago

Last modified 2 weeks ago

#1355 new defect/bug

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 (2)

comment:1 Changed 2 weeks ago by wiki.navit-project.org/index.php/user:charles

Probably fixed in branch fixImperialAgain. See pull request fix:gtk:Fix imperial factors. Again.

comment:2 Changed 2 weeks 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.

Note: See TracTickets for help on using tickets.