MS Windows can't handle the symbols ... sigh
This commit is contained in:
parent
887a1a732e
commit
3cb5b0159d
1 changed files with 14 additions and 14 deletions
|
@ -17,7 +17,7 @@
|
||||||
#include "layout.hxx"
|
#include "layout.hxx"
|
||||||
|
|
||||||
|
|
||||||
enum format_type { INVALID, INT, LONG, FLOAT, DOUBLE, STRING };
|
enum format_type { f_INVALID, f_INT, f_LONG, f_FLOAT, f_DOUBLE, f_STRING };
|
||||||
static const int FORMAT_BUFSIZE = 255;
|
static const int FORMAT_BUFSIZE = 255;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -39,7 +39,7 @@ validate_format(const char *f)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (*f++ != '%')
|
if (*f++ != '%')
|
||||||
return INVALID;
|
return f_INVALID;
|
||||||
if (*f == ' ' || *f == '+' || *f == '-' || *f == '#')
|
if (*f == ' ' || *f == '+' || *f == '-' || *f == '#')
|
||||||
f++;
|
f++;
|
||||||
while (*f && isdigit(*f))
|
while (*f && isdigit(*f))
|
||||||
|
@ -54,22 +54,22 @@ validate_format(const char *f)
|
||||||
l = true, f++;
|
l = true, f++;
|
||||||
|
|
||||||
if (*f == 'd') {
|
if (*f == 'd') {
|
||||||
type = l ? LONG : INT;
|
type = l ? f_LONG : f_INT;
|
||||||
} else if (*f == 'f')
|
} else if (*f == 'f')
|
||||||
type = l ? DOUBLE : FLOAT;
|
type = l ? f_DOUBLE : f_FLOAT;
|
||||||
else if (*f == 's') {
|
else if (*f == 's') {
|
||||||
if (l)
|
if (l)
|
||||||
return INVALID;
|
return f_INVALID;
|
||||||
type = STRING;
|
type = f_STRING;
|
||||||
} else
|
} else
|
||||||
return INVALID;
|
return f_INVALID;
|
||||||
|
|
||||||
for (++f; *f; f++) {
|
for (++f; *f; f++) {
|
||||||
if (*f == '%') {
|
if (*f == '%') {
|
||||||
if (f[1] == '%')
|
if (f[1] == '%')
|
||||||
f++;
|
f++;
|
||||||
else
|
else
|
||||||
return INVALID;
|
return f_INVALID;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return type;
|
return type;
|
||||||
|
@ -102,7 +102,7 @@ GUIInfo::GUIInfo (FGDialog * d)
|
||||||
key(-1),
|
key(-1),
|
||||||
text(0),
|
text(0),
|
||||||
fmt_string(0),
|
fmt_string(0),
|
||||||
fmt_type(INVALID)
|
fmt_type(f_INVALID)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -118,13 +118,13 @@ GUIInfo::~GUIInfo ()
|
||||||
|
|
||||||
char *GUIInfo::format(SGPropertyNode *n)
|
char *GUIInfo::format(SGPropertyNode *n)
|
||||||
{
|
{
|
||||||
if (fmt_type == INT)
|
if (fmt_type == f_INT)
|
||||||
snprintf(text, FORMAT_BUFSIZE, fmt_string, n->getIntValue());
|
snprintf(text, FORMAT_BUFSIZE, fmt_string, n->getIntValue());
|
||||||
else if (fmt_type == LONG)
|
else if (fmt_type == f_LONG)
|
||||||
snprintf(text, FORMAT_BUFSIZE, fmt_string, n->getLongValue());
|
snprintf(text, FORMAT_BUFSIZE, fmt_string, n->getLongValue());
|
||||||
else if (fmt_type == FLOAT)
|
else if (fmt_type == f_FLOAT)
|
||||||
snprintf(text, FORMAT_BUFSIZE, fmt_string, n->getFloatValue());
|
snprintf(text, FORMAT_BUFSIZE, fmt_string, n->getFloatValue());
|
||||||
else if (fmt_type == DOUBLE)
|
else if (fmt_type == f_DOUBLE)
|
||||||
snprintf(text, FORMAT_BUFSIZE, fmt_string, n->getDoubleValue());
|
snprintf(text, FORMAT_BUFSIZE, fmt_string, n->getDoubleValue());
|
||||||
else
|
else
|
||||||
snprintf(text, FORMAT_BUFSIZE, fmt_string, n->getStringValue());
|
snprintf(text, FORMAT_BUFSIZE, fmt_string, n->getStringValue());
|
||||||
|
@ -773,7 +773,7 @@ FGDialog::setupObject (puObject * object, SGPropertyNode * props)
|
||||||
const char *format = props->getStringValue("format", 0);
|
const char *format = props->getStringValue("format", 0);
|
||||||
if (format) {
|
if (format) {
|
||||||
info->fmt_type = validate_format(props->getStringValue("format", 0));
|
info->fmt_type = validate_format(props->getStringValue("format", 0));
|
||||||
if (info->fmt_type != INVALID) {
|
if (info->fmt_type != f_INVALID) {
|
||||||
info->text = new char[FORMAT_BUFSIZE + 1];
|
info->text = new char[FORMAT_BUFSIZE + 1];
|
||||||
info->fmt_string = new char[strlen(format) + 1];
|
info->fmt_string = new char[strlen(format) + 1];
|
||||||
strcpy(info->fmt_string, format);
|
strcpy(info->fmt_string, format);
|
||||||
|
|
Loading…
Reference in a new issue