Exception: Constructor now takes printf style arguments

This commit is contained in:
Jonas Kulla 2013-12-29 18:05:11 +01:00
parent 5b736bcfd6
commit 9759e52b3c
7 changed files with 20 additions and 30 deletions

View file

@ -275,9 +275,7 @@ runRMXPScripts(mrb_state *mrb, mrbc_context *ctx)
}
catch (const Exception &e)
{
char buffer[512];
snprintf(buffer, sizeof(buffer), e.fmt.c_str(), e.arg1.c_str(), e.arg2.c_str());
readError = std::string(": ") + std::string(buffer);
readError = std::string(": ") + e.msg;
}
SDL_RWclose(&ops);

View file

@ -138,9 +138,7 @@ void raiseMrbExc(mrb_state *mrb, const Exception &exc)
MrbData *data = getMrbData(mrb);
RClass *excClass = data->exc[excToMrbExc[exc.type]];
static char buffer[512];
exc.snprintf(buffer, sizeof(buffer));
mrb_raise(mrb, excClass, buffer);
mrb_raise(mrb, excClass, exc.msg.c_str());
}
MRB_METHOD_PUB(inspectObject)

View file

@ -548,8 +548,8 @@ read_value(MarshalContext *ctx)
break;
default :
throw Exception(Exception::MKXPError, "Marshal.load: unsupported value type '%s'",
std::string(1, (char)type));
throw Exception(Exception::MKXPError, "Marshal.load: unsupported value type '%c'",
(char) type);
}
mrb_gc_arena_restore(mrb, arena);