aerostitch / testnavit

0 stars 0 forks source link

CID 200497: Incorrect expression (UNINTENDED_INTEGER_DIVISION) #291

Closed aerostitch closed 6 years ago

aerostitch commented 7 years ago

Issue migrated from trac ticket # 1355

component: core | priority: major

2017-10-31 22:36:28: @pgrandin created the issue


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     }
aerostitch commented 6 years ago

2017-11-30 09:27:27: wiki.navit-project.org/index.php/user:charles commented


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

aerostitch commented 6 years ago

2017-12-02 04:08:44: @jkoan

aerostitch commented 6 years ago

2017-12-02 04:08:44: @jkoan commented


This ticket was pushed back in order to bring 0.5.1 out soon.

charlescurley commented 6 years ago

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.

aerostitch commented 6 years ago

Sorry, that repo is just a migration test for migrating the trac issues to git (that migration has been put on hold because some members want to continue using trac), the actual ticket is still in trac. But I'll close the one in trac. Thanks! :)

aerostitch commented 6 years ago

Updated http://trac.navit-project.org/ticket/1355