Skip to content

Commit

Permalink
Make enum values uppercase in frt.h.
Browse files Browse the repository at this point in the history
  • Loading branch information
Relintai committed Apr 21, 2024
1 parent 18906f3 commit afaf29c
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 16 deletions.
16 changes: 8 additions & 8 deletions platform/frt/frt.h
Original file line number Diff line number Diff line change
Expand Up @@ -89,10 +89,10 @@ struct EventHandler {

struct Value {
enum Type {
Bool,
Int,
Float,
String,
BOOL,
INT,
FLOAT,
STRING,
} t;
union {
bool b;
Expand All @@ -101,13 +101,13 @@ struct Value {
const char *s;
} u;
Value(bool v)
: t(Bool) { u.b = v; }
: t(BOOL) { u.b = v; }
Value(int v)
: t(Int) { u.i = v; }
: t(INT) { u.i = v; }
Value(float v)
: t(Float) { u.f = v; }
: t(FLOAT) { u.f = v; }
Value(const char *v)
: t(String) { u.s = v; }
: t(STRING) { u.s = v; }
};

struct Param {
Expand Down
8 changes: 4 additions & 4 deletions platform/frt/frt_options.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ void parse_frt_param(const char *name, const char *value) {
}
Value &v = p->value;
switch (v.t) {
case Value::Bool:
case Value::BOOL:
if (!strcmp(value, "true")) {
v.u.b = true;
} else if (!strcmp(value, "false")) {
Expand All @@ -117,13 +117,13 @@ void parse_frt_param(const char *name, const char *value) {
exit(1);
}
break;
case Value::Int:
case Value::INT:
v.u.i = atoi(value);
break;
case Value::Float:
case Value::FLOAT:
v.u.f = (float)atof(value);
break;
case Value::String:
case Value::STRING:
v.u.s = value;
break;
}
Expand Down
8 changes: 4 additions & 4 deletions platform/frt/os_frt.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -283,16 +283,16 @@ class OS_FRT : public OS_Unix, public Runnable {
p->source = Param::ProjectSettings;
Value &v = p->value;
switch (v.t) {
case Value::Bool:
case Value::BOOL:
v.u.b = bool(project_settings->get(name));
break;
case Value::Int:
case Value::INT:
v.u.i = int(project_settings->get(name));
break;
case Value::Float:
case Value::FLOAT:
v.u.f = float(project_settings->get(name));
break;
case Value::String: {
case Value::STRING: {
String s = String(project_settings->get(name));
v.u.s = strdup(s.ascii());
// TODO: keep track and dealloc string copy
Expand Down

0 comments on commit afaf29c

Please sign in to comment.