Patch from Frederic Bouvier (FIXME comments added by David Megginson):
I made these modifications to correct the problem of getter functions returning pointers to local variables. Those variables are no longer locals and become static. One should be aware that it kills reentrancy !
This commit is contained in:
parent
396674ce2e
commit
aa872ed040
1 changed files with 5 additions and 9 deletions
|
@ -102,7 +102,7 @@ static const char *
|
||||||
getLoggingClasses ()
|
getLoggingClasses ()
|
||||||
{
|
{
|
||||||
sgDebugClass classes = logbuf::get_log_classes();
|
sgDebugClass classes = logbuf::get_log_classes();
|
||||||
string result = "";
|
static string result = ""; // FIXME
|
||||||
for (int i = 0; log_class_mappings[i].c != SG_UNDEFD; i++) {
|
for (int i = 0; log_class_mappings[i].c != SG_UNDEFD; i++) {
|
||||||
if ((classes&log_class_mappings[i].c) > 0) {
|
if ((classes&log_class_mappings[i].c) > 0) {
|
||||||
if (!result.empty())
|
if (!result.empty())
|
||||||
|
@ -249,14 +249,12 @@ getElapsedTime_ms ()
|
||||||
static const char *
|
static const char *
|
||||||
getDateString ()
|
getDateString ()
|
||||||
{
|
{
|
||||||
string out;
|
static char buf[64]; // FIXME
|
||||||
char buf[64];
|
|
||||||
struct tm * t = globals->get_time_params()->getGmt();
|
struct tm * t = globals->get_time_params()->getGmt();
|
||||||
sprintf(buf, "%.4d-%.2d-%.2dT%.2d:%.2d:%.2d",
|
sprintf(buf, "%.4d-%.2d-%.2dT%.2d:%.2d:%.2d",
|
||||||
t->tm_year + 1900, t->tm_mon + 1, t->tm_mday,
|
t->tm_year + 1900, t->tm_mon + 1, t->tm_mday,
|
||||||
t->tm_hour, t->tm_min, t->tm_sec);
|
t->tm_hour, t->tm_min, t->tm_sec);
|
||||||
out = buf;
|
return buf;
|
||||||
return out.c_str();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -313,14 +311,12 @@ setDateString (const char * date_string)
|
||||||
static const char *
|
static const char *
|
||||||
getGMTString ()
|
getGMTString ()
|
||||||
{
|
{
|
||||||
string out;
|
static char buf[16]; // FIXME
|
||||||
char buf[16];
|
|
||||||
struct tm *t = globals->get_time_params()->getGmt();
|
struct tm *t = globals->get_time_params()->getGmt();
|
||||||
sprintf(buf, " %.2d:%.2d:%.2d",
|
sprintf(buf, " %.2d:%.2d:%.2d",
|
||||||
t->tm_hour, t->tm_min, t->tm_sec);
|
t->tm_hour, t->tm_min, t->tm_sec);
|
||||||
// cout << t << " " << buf << endl;
|
// cout << t << " " << buf << endl;
|
||||||
out = buf;
|
return buf;
|
||||||
return out.c_str();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue