Skip to content

Commit

Permalink
Fixed compiler warnings.
Browse files Browse the repository at this point in the history
  • Loading branch information
hmatuschek committed Oct 21, 2022
1 parent 346a8c8 commit 094e915
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 27 deletions.
12 changes: 6 additions & 6 deletions lib/csvreader.hh
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,10 @@ class CSVLexer: public QObject

public:
/** The token. */
typedef struct {
struct Token {
public:
/** Possible token types. */
typedef enum {
enum TokenType {
T_KEYWORD, ///< A Keyword/Identifier.
T_APRSCALL, ///< A APRS call of form CALL-SSID.
T_STRING, ///< A quoted string.
Expand All @@ -46,7 +46,7 @@ public:

T_END_OF_STREAM, ///< Indicates the end-of-input.
T_ERROR ///< Indicates a lexer error.
} TokenType;
};

/// The token type.
TokenType type;
Expand All @@ -56,17 +56,17 @@ public:
qint64 line;
/// Column number.
qint64 column;
} Token;
};

/// Current state of lexer.
typedef struct {
struct State {
/// The current stream offset.
qint64 offset;
/// The current line count.
qint64 line;
/// The current column number.
qint64 column;
} State;
};

public:
/** Constructs a lexer for the given stream. */
Expand Down
36 changes: 18 additions & 18 deletions lib/opengd77_interface.hh
Original file line number Diff line number Diff line change
Expand Up @@ -53,17 +53,17 @@ public:

protected:
/** Represents a read message. */
typedef struct __attribute__((packed)) {
struct __attribute__((packed)) ReadRequest {
/** Possible read sources. */
typedef enum {
enum Command {
READ_FLASH = 1,
READ_EEPROM = 2,
READ_MCU_ROM = 5,
READ_DISPLAY_BUFFER = 6,
READ_WAV_BUFFER = 7,
READ_AMBE_BUFFER = 8,
READ_FIRMWARE_INFO = 9
} Command;
};

/// 'R' read block, 'W' write block, 'C' command.
char type;
Expand All @@ -80,10 +80,10 @@ protected:
bool initReadEEPROM(uint32_t address, uint16_t length);
/** Constructs a firmware-info read message. */
bool initReadFirmwareInfo();
} ReadRequest;
};

/** Represents a read response message. */
typedef struct __attribute__((packed)) {
struct __attribute__((packed)) ReadResponse {
/// Same code as request. That is 'R' read block, 'W' write block, 'C' command.
char type;
/// Length of paylod.
Expand All @@ -101,18 +101,18 @@ protected:
uint32_t _unknown24; ///< Some unknown number in little endian, seen 0x4014
} radio_info;
};
} ReadResponse;
};

/** Represents a write message. */
typedef struct __attribute__((packed)) {
struct __attribute__((packed)) WriteRequest {
/** Possible write destinations. */
typedef enum {
enum Command {
SET_FLASH_SECTOR = 1,
WRITE_SECTOR_BUFFER = 2,
WRITE_FLASH_SECTOR = 3,
WRITE_EEPROM = 4,
WRITE_WAV_BUFFER = 7
} Command;
};

/// 'R' read block, 'W' write block or 'C' command.
char type;
Expand Down Expand Up @@ -141,36 +141,36 @@ protected:
bool initWriteFlash(uint32_t addr, const uint8_t *data, uint16_t size);
/** Constructs a finish-write-to-flash message. */
bool initFinishWriteFlash();
} WriteRequest;
};

/** Represents a write-response message. */
typedef struct __attribute__((packed)) {
struct __attribute__((packed)) WriteResponse {
/// Same code as request. That is 'R' read block, 'W' write block, 'C' command or '-' on Error.
char type;
/// Same code as request if OK.
uint8_t command;
} WriteResponse;
};

/** Represents a command message. */
typedef struct __attribute__((packed)) {
struct __attribute__((packed)) CommandRequest {
/** Possible commands. */
typedef enum {
enum Command {
SHOW_CPS_SCREEN = 0,
CLEAR_SCREEN = 1,
DISPLAY = 2,
RENDER_CPS = 3,
CLOSE_CPS_SCREEN = 5,
COMMAND = 6
} Command;
};

/** Possible options. */
typedef enum {
enum Option {
SAVE_SETTINGS_NOT_VFOS = 0,
REBOOT = 1,
SAVE_SETTINGS_AND_VFOS = 2,
FLASH_GREEN_LED = 3,
FLASH_RED_LED = 4
} Option;
};

/** Message type, here 'C' for command. */
char type;
Expand Down Expand Up @@ -206,7 +206,7 @@ protected:
void initCloseScreen();
/** Construct a command message with the given option. */
void initCommand(Option option);
} CommandRequest;
};

protected:
/** Write some data to EEPROM at the given address. */
Expand Down
6 changes: 3 additions & 3 deletions lib/radiolimits.cc
Original file line number Diff line number Diff line change
Expand Up @@ -626,15 +626,15 @@ RadioLimitObjRef::verify(const ConfigItem *item, const QMetaProperty &prop, Radi

auto &msg = context.newMessage(RadioLimitIssue::Warning);
msg << "Property '" << prop.name() << "' must refer to an instances of "
<< QStringList::fromSet(_types).join(", ") << ".";
<< QStringList(_types.begin(), _types.end()).join(", ") << ".";

return true;
}

if (! validType(ref->as<ConfigObject>()->metaObject())) {
auto &msg = context.newMessage(RadioLimitIssue::Critical);
msg << "Property '" << prop.name() << "' must refer to an instances of "
<< QStringList::fromSet(_types).join(", ") << ".";
<< QStringList(_types.begin(), _types.end()).join(", ") << ".";
return false;
}

Expand Down Expand Up @@ -816,7 +816,7 @@ RadioLimitRefList::verify(const ConfigItem *item, const QMetaProperty &prop, Rad
if (! validType(plist->get(i)->metaObject())) {
auto &msg = context.newMessage(RadioLimitIssue::Critical);
msg << "Reference to " << plist->get(i)->metaObject()->className() << " is not allowed here. "
<< "Must be one of " << QStringList::fromSet(_types).join(", ") << ".";
<< "Must be one of " << QStringList(_types.begin(), _types.end()).join(", ") << ".";
return false;
}
}
Expand Down

0 comments on commit 094e915

Please sign in to comment.