Skip to content

Commit

Permalink
clang-tidy modernize-use-using.
Browse files Browse the repository at this point in the history
replace typedef syntax.
this was done by hand.
  • Loading branch information
tsteven4 committed Nov 28, 2019
1 parent 6982fd1 commit a64f11a
Show file tree
Hide file tree
Showing 62 changed files with 497 additions and 497 deletions.
32 changes: 16 additions & 16 deletions an1.cc
Original file line number Diff line number Diff line change
Expand Up @@ -48,10 +48,10 @@ static double radius = 0.0;
static long serial=10000;
static long rtserial=1;

typedef struct roadchange {
struct roadchange {
long type;
char* name;
} roadchange;
};

static roadchange* roadchanges = nullptr;

Expand Down Expand Up @@ -97,11 +97,11 @@ arglist_t an1_args[] = {
ARG_TERMINATOR
};

typedef struct guid {
struct guid_t {
unsigned long l;
unsigned short s[3];
unsigned char c[6];
} GUID;
};

#include "an1sym.h"

Expand All @@ -127,7 +127,7 @@ ReadString(gbfile* f, short len)
#define WriteString(f,s) gbfputs((s),f)

static void
ReadGuid(gbfile* f, GUID* guid)
ReadGuid(gbfile* f, guid_t* guid)
{
guid->l = ReadLong(f);
for (unsigned short &i : guid->s) {
Expand All @@ -139,7 +139,7 @@ ReadGuid(gbfile* f, GUID* guid)
}

static void
WriteGuid(gbfile* f, GUID* guid)
WriteGuid(gbfile* f, guid_t* guid)
{
WriteLong(f, guid->l);
for (int i = 0; i < 3; i++) {
Expand Down Expand Up @@ -169,15 +169,15 @@ EncodeOrd(double ord)
return (int32_t)(0x80000000 - (int32_t)(ord * 0x800000));
}

typedef struct {
struct an1_symbol_record {
short hotspotxhi;
long hotspoty;
long unk1;
GUID guid;
guid_t guid;
char* name;
} an1_symbol_record;
};

typedef struct {
struct an1_waypoint_record {
format_specific_data fs;
short magic;
long unk1;
Expand All @@ -196,7 +196,7 @@ typedef struct {
double radius; /* in km */
char* name;
char* fontname;
GUID guid;
guid_t guid;
long fontcolor;
long fontstyle;
long fontsize;
Expand All @@ -214,18 +214,18 @@ typedef struct {
long creation_time;
long modification_time;
char* image_name;
} an1_waypoint_record;
};

typedef struct {
struct an1_vertex_record {
format_specific_data fs;
short magic;
long unk0;
long lon;
long lat;
short unk1;
} an1_vertex_record;
};

typedef struct {
struct an1_line_record {
format_specific_data fs;
long roadtype;
short serial;
Expand All @@ -243,7 +243,7 @@ typedef struct {
long unk7;
short unk8;
long pointcount;
} an1_line_record;
};

static an1_waypoint_record* Alloc_AN1_Waypoint();

Expand Down
10 changes: 5 additions & 5 deletions an1sym.h
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@
*/

static struct defguid {
GUID guid;
guid_t guid;
const char* name;
} default_guids[] = {
{ {0xb610bc70,{0x377e, 0x11d6, 0xaeb3}, {0x00, 0x01, 0x02, 0x31, 0x5f, 0xfd}},
Expand Down Expand Up @@ -708,21 +708,21 @@ static struct defguid {
},
};

static int FindIconByName(const char* name, GUID* guid)
static int FindIconByName(const char* name, guid_t* guid)
{
for (unsigned int i = 0; i < (sizeof(default_guids)/sizeof(struct defguid)); i++) {
if (!case_ignore_strcmp(name, default_guids[i].name)) {
memcpy(guid, &(default_guids[i].guid), sizeof(GUID));
memcpy(guid, &(default_guids[i].guid), sizeof(guid_t));
return 1;
}
}
return 0;
}

static int FindIconByGuid(GUID* guid, char** name)
static int FindIconByGuid(guid_t* guid, char** name)
{
for (unsigned int i = 0; i < (sizeof(default_guids)/sizeof(struct defguid)); i++) {
if (!memcmp(guid, &default_guids[i].guid, sizeof(GUID))) {
if (!memcmp(guid, &default_guids[i].guid, sizeof(guid_t))) {
*name = const_cast<char*>(default_guids[i].name);
return 1;
}
Expand Down
4 changes: 2 additions & 2 deletions arcdist.h
Original file line number Diff line number Diff line change
Expand Up @@ -47,12 +47,12 @@ class ArcDistanceFilter:public Filter
char* ptsopt = nullptr;
char* projectopt = nullptr;

typedef struct {
struct extra_data {
double distance;
double prjlatitude, prjlongitude;
double frac;
Waypoint* arcpt1, * arcpt2;
} extra_data;
};

arglist_t args[8] = {
{
Expand Down
4 changes: 2 additions & 2 deletions bcr.cc
Original file line number Diff line number Diff line change
Expand Up @@ -88,12 +88,12 @@ arglist_t bcr_args[] = {
ARG_TERMINATOR
};

typedef struct {
struct bcr_icon_mapping_t {
const char* bcr_name;
const char* mps_name;
const char* symbol_DE;
bool warned;
} bcr_icon_mapping_t;
};

static
bcr_icon_mapping_t bcr_icon_mapping[] = {
Expand Down
4 changes: 2 additions & 2 deletions brauniger_iq.cc
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ static void* serial_handle;
#define MYNAME "BRAUNIGER-IQ"
#define PRESTRKNAME "PRESALTTRK"

typedef enum {
enum state_t {
st_sync,
st_fl_num,
st_data_len,
Expand All @@ -45,7 +45,7 @@ typedef enum {
st_sample_alt,
st_sample_spd,
num_states
} state_t;
};
static state_t state;
inline state_t& operator++(state_t& s) // prefix
{
Expand Down
12 changes: 6 additions & 6 deletions bushnell.cc
Original file line number Diff line number Diff line change
Expand Up @@ -37,12 +37,12 @@ arglist_t bushnell_args[] = {
// Apparently, the icons are undocumented, so we made up names,
// preferring them to be consistent with other brands where possible.

typedef struct {
const signed int symbol;
struct bushnell_icon_mapping_t {
signed int symbol;
const char* icon;
} icon_mapping_t;
};

static icon_mapping_t bushnell_icons[] = {
static const bushnell_icon_mapping_t bushnell_icons[] = {
{ 0x00, "Yellow Square"},
{ 0x01, "Blue Grey Circle" },
{ 0x02, "Yellow Diamond" },
Expand Down Expand Up @@ -134,7 +134,7 @@ bushnell_get_icon_from_name(QString name)
name = "Waypoint";
}

for (icon_mapping_t* t = bushnell_icons; t->icon != nullptr; t++) {
for (const bushnell_icon_mapping_t* t = bushnell_icons; t->icon != nullptr; t++) {
if (0 == name.compare(t->icon, Qt::CaseInsensitive)) {
return t->symbol;
}
Expand All @@ -145,7 +145,7 @@ bushnell_get_icon_from_name(QString name)
static const char*
bushnell_get_name_from_symbol(signed int s)
{
for (icon_mapping_t* t = bushnell_icons; t->icon != nullptr; t++) {
for (const bushnell_icon_mapping_t* t = bushnell_icons; t->icon != nullptr; t++) {
if (s == t->symbol) {
return t->icon;
}
Expand Down
12 changes: 6 additions & 6 deletions cet.h
Original file line number Diff line number Diff line change
Expand Up @@ -27,15 +27,15 @@
#define CET_ERROR 1
#define CET_SUCCESS 0

typedef struct cet_ucs4_link_s {
struct cet_ucs4_link_t {
int value; /* UCS-4 value */
short origin; /* associated character */
} cet_ucs4_link_t;
};

typedef struct cet_cs_vec_s {
struct cet_cs_vec_t {
const char* name; /* name of character set */
const char** alias; /* alias table */
struct cet_cs_vec_s* fallback; /* fallback character set */
cet_cs_vec_t* fallback; /* fallback character set */
void* unused;
const int* ucs4_map; /* char to UCS-4 value table */
const int ucs4_offset; /* first non standard character */
Expand All @@ -44,8 +44,8 @@ typedef struct cet_cs_vec_s {
const int ucs4_links; /* number of links */
const cet_ucs4_link_t* ucs4_extra; /* Non standard UCS-4 to ... */
const int ucs4_extras; /* number of extra links */
struct cet_cs_vec_s* next;
} cet_cs_vec_t;
cet_cs_vec_t* next;
};

/* single char/value transmission */

Expand Down
4 changes: 2 additions & 2 deletions cet_util.cc
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,10 @@

static cet_cs_vec_t* cet_cs_vec_root = nullptr;

typedef struct cet_cs_alias_s {
struct cet_cs_alias_t {
char* name;
cet_cs_vec_t* vec;
} cet_cs_alias_t;
};

static cet_cs_alias_t* cet_cs_alias;
static int cet_cs_alias_ct = 0;
Expand Down
Loading

0 comments on commit a64f11a

Please sign in to comment.