Skip to content

Commit

Permalink
use c++11 fixed width integer types in jeeps. (#1217)
Browse files Browse the repository at this point in the history
* use c++11 fixed width integer types in jeeps.

thanks resharper!

* fix fixed width integers resharper missed.

in non windows code.
  • Loading branch information
tsteven4 authored Nov 15, 2023
1 parent de0458e commit 93511ca
Show file tree
Hide file tree
Showing 31 changed files with 905 additions and 882 deletions.
26 changes: 26 additions & 0 deletions CMakeSettings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
{
"configurations": [
{
"name": "x64-Debug",
"generator": "Ninja",
"configurationType": "Debug",
"inheritEnvironments": [ "msvc_x64_x64" ],
"buildRoot": "${projectDir}\\out\\build\\${name}",
"installRoot": "${projectDir}\\out\\install\\${name}",
"cmakeCommandArgs": "-DCMAKE_PREFIX_PATH=C:/Qt/6.5.3/msvc2019_64",
"buildCommandArgs": "",
"ctestCommandArgs": ""
},
{
"name": "x64-Clang-Debug",
"generator": "Ninja",
"configurationType": "Debug",
"buildRoot": "${projectDir}\\out\\build\\${name}",
"installRoot": "${projectDir}\\out\\install\\${name}",
"cmakeCommandArgs": "-DCMAKE_PREFIX_PATH=C:/Qt/6.5.3/msvc2019_64 -DCMAKE_VERBOSE_MAKEFILE=ON",
"buildCommandArgs": "",
"ctestCommandArgs": "",
"inheritEnvironments": [ "clang_cl_x64_x64" ]
}
]
}
8 changes: 4 additions & 4 deletions garmin.cc
Original file line number Diff line number Diff line change
Expand Up @@ -535,7 +535,7 @@ track_read()
}


int32 ntracks = GPS_Command_Get_Track(portname, &array, waypt_read_cb);
int32_t ntracks = GPS_Command_Get_Track(portname, &array, waypt_read_cb);

if (ntracks <= 0) {
return;
Expand Down Expand Up @@ -613,7 +613,7 @@ route_read()
*/
route_head* rte_head = nullptr;

int32 nroutepts = GPS_Command_Get_Route(portname, &array);
int32_t nroutepts = GPS_Command_Get_Route(portname, &array);

// fprintf(stderr, "Routes %d\n", (int) nroutepts);
#if 1
Expand Down Expand Up @@ -974,7 +974,7 @@ waypoint_write()
{
int n = waypoint_prepare();

if (int32 ret = GPS_Command_Send_Waypoint(portname, tx_waylist, n, waypt_write_cb); ret < 0) {
if (int32_t ret = GPS_Command_Send_Waypoint(portname, tx_waylist, n, waypt_write_cb); ret < 0) {
fatal(MYNAME ":communication error sending waypoints..\n");
}

Expand Down Expand Up @@ -1103,7 +1103,7 @@ track_waypt_pr(const Waypoint* wpt)
static int
track_prepare()
{
int32 n = track_waypt_count() + track_count();
int32_t n = track_waypt_count() + track_count();

tx_tracklist = (GPS_STrack**) xcalloc(n, sizeof(GPS_PTrack));
cur_tx_tracklist_entry = tx_tracklist;
Expand Down
76 changes: 38 additions & 38 deletions jeeps/gps.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,17 +20,17 @@
#define ETX 0x03


extern int32 gps_errno;
extern int32 gps_warning;
extern int32 gps_error;
extern int32 gps_user;
extern int32 gps_show_bytes;
extern int32_t gps_errno;
extern int32_t gps_warning;
extern int32_t gps_error;
extern int32_t gps_user;
extern int32_t gps_show_bytes;
extern char gps_categories[16][17];


struct GPS_Packet {
US type{0};
uint32 n{0};
uint32_t n{0};
UC data[MAX_GPS_PACKET_SIZE]{};
};

Expand All @@ -51,16 +51,16 @@ typedef struct GPS_SPvt_Data_Type {
float epe;
float eph;
float epv;
int16 fix;
int16_t fix;
double tow;
double lat;
double lon;
float east;
float north;
float up;
float msl_hght;
int16 leap_scnds;
int32 wn_days;
int16_t leap_scnds;
int32_t wn_days;
} GPS_OPvt_Data, *GPS_PPvt_Data;


Expand All @@ -79,8 +79,8 @@ typedef struct GPS_STrack {
unsigned int tnew:1; /* New track? */
unsigned int ishdr:1; /* Track header? */
unsigned int no_latlon:1; /* True if no valid lat/lon found. */
int32 dspl; /* Display on map? */
int32 colour; /* Colour */
int32_t dspl; /* Display on map? */
int32_t colour; /* Colour */
float distance; /* distance traveled in meters.*/
int distance_populated; /* True if above is valid. */
char trk_ident[256]; /* Track identifier */
Expand All @@ -91,7 +91,7 @@ GPS_OTrack, *GPS_PTrack;

typedef struct GPS_SAlmanac {
UC svid;
int16 wn;
int16_t wn;
float toa;
float af0;
float af1;
Expand All @@ -112,12 +112,12 @@ typedef struct GPS_SWay {
double lon;
char cmnt[256];
float dst;
int32 smbl;
int32 dspl;
int32_t smbl;
int32_t dspl;
char wpt_ident[256];
char lnk_ident[256];
UC subclass[18];
int32 colour;
int32_t colour;
char cc[2];
UC wpt_class;
UC alt_is_unknown;
Expand All @@ -128,42 +128,42 @@ typedef struct GPS_SWay {
char facility[32];
char addr[52];
char cross_road[52];
int32 attr;
int32_t attr;
float dpth;
int32 idx;
int32 prot;
int32 isrte;
int32 rte_prot;
int32_t idx;
int32_t prot;
int32_t isrte;
int32_t rte_prot;
UC rte_num;
char rte_cmnt[20];
char rte_ident[256];
int32 islink;
int32 rte_link_class;
int32_t islink;
int32_t rte_link_class;
char rte_link_subclass[18];
char rte_link_ident[256];

char time_populated; /* 1 if true */
time_t time; /* Unix time */
char temperature_populated;
float temperature; /* Degrees celsius. */
uint16 category;
uint16_t category;

} GPS_OWay, *GPS_PWay;

/*
* Forerunner/Edge Lap data.
*/
typedef struct GPS_SLap {
uint32 index; /* unique index in device or -1 */
uint32_t index; /* unique index in device or -1 */
time_t start_time;
uint32 total_time; /* Hundredths of a second */
uint32_t total_time; /* Hundredths of a second */
float total_distance; /* In meters */
double begin_lat;
double begin_lon;
double end_lat;
double end_lon;
int16 calories;
uint32 track_index; /* ref to track or -1 */
int16_t calories;
uint32_t track_index; /* ref to track or -1 */
float max_speed; /* In meters per second */
unsigned char avg_heart_rate; /* In beats-per-minute, 0 if invalid */
unsigned char max_heart_rate; /* In beats-per-minute, 0 if invalid */
Expand All @@ -179,17 +179,17 @@ typedef struct GPS_SLap {


typedef struct GPS_SCourse {
uint32 index; /* Unique among courses on device */
uint32_t index; /* Unique among courses on device */
char course_name[16]; /* Null-terminated unique course name */
uint32 track_index; /* Index of the associated track
uint32_t track_index; /* Index of the associated track
* Must be 0xFFFFFFFF if there is none*/
} GPS_OCourse, *GPS_PCourse;


typedef struct GPS_SCourse_Lap {
uint32 course_index; /* Index of associated course */
uint32 lap_index; /* This lap's index in the course */
uint32 total_time; /* In hundredths of a second */
uint32_t course_index; /* Index of associated course */
uint32_t lap_index; /* This lap's index in the course */
uint32_t total_time; /* In hundredths of a second */
float total_dist; /* [m] */
double begin_lat; /* Starting position of the lap */
double begin_lon; /* Invalid if lat,lon are 0x7FFFFFFF.*/
Expand All @@ -204,7 +204,7 @@ typedef struct GPS_SCourse_Lap {

typedef struct GPS_SCourse_Point {
char name[11]; /* Null-terminated name */
uint32 course_index; /* Index of associated course */
uint32_t course_index; /* Index of associated course */
time_t track_point_time; /* Time */
UC point_type; /* generic = 0,
* summit = 1,
Expand All @@ -225,10 +225,10 @@ typedef struct GPS_SCourse_Point {
} GPS_OCourse_Point, *GPS_PCourse_Point;

typedef struct GPS_SCourse_Limits {
int32 max_courses;
int32 max_course_laps;
int32 max_course_pnt;
int32 max_course_trk_pnt;
int32_t max_courses;
int32_t max_course_laps;
int32_t max_course_pnt;
int32_t max_course_trk_pnt;
} GPS_OCourse_Limits, *GPS_PCourse_Limits;


Expand All @@ -249,7 +249,7 @@ using pcb_fn = int (*)(int, GPS_SWay**);
extern time_t gps_save_time;
extern double gps_save_lat;
extern double gps_save_lon;
extern int32 gps_save_id;
extern int32_t gps_save_id;
extern double gps_save_version;
extern char gps_save_string[GPS_ARB_LEN];
extern int gps_is_usb;
Expand Down
Loading

0 comments on commit 93511ca

Please sign in to comment.