diff options
author | Adam Borowski <kilobyte@angband.pl> | 2009-12-17 12:48:02 +0100 |
---|---|---|
committer | Adam Borowski <kilobyte@angband.pl> | 2009-12-17 12:48:02 +0100 |
commit | 1ab177757bec9eb28482785f75fd8a4fb8a1313c (patch) | |
tree | 4b1c8babcca442dc8b91a624b842bc5f30013747 /crawl-ref/source/hiscores.cc | |
parent | c266f14414471d5252130c70bafa0c60f85a265c (diff) | |
download | crawl-ref-1ab177757bec9eb28482785f75fd8a4fb8a1313c.tar.gz crawl-ref-1ab177757bec9eb28482785f75fd8a4fb8a1313c.zip |
Replace static snprintf() with make_sprintf() where the result is immediately cast
to std::string.
Diffstat (limited to 'crawl-ref/source/hiscores.cc')
-rw-r--r-- | crawl-ref/source/hiscores.cc | 10 |
1 files changed, 4 insertions, 6 deletions
diff --git a/crawl-ref/source/hiscores.cc b/crawl-ref/source/hiscores.cc index 81bf6479e8..cbbd3b518c 100644 --- a/crawl-ref/source/hiscores.cc +++ b/crawl-ref/source/hiscores.cc @@ -1430,10 +1430,9 @@ std::string scorefile_entry::death_place(death_desc_verbosity verbosity) const if (verbosity == DDV_ONELINE || verbosity == DDV_TERSE) { - snprintf( scratch, sizeof scratch, " (%s)", - place_name(get_packed_place(branch, dlvl, level_type), - false, true).c_str()); - return (scratch); + return (make_stringf(" (%s)", + place_name(get_packed_place(branch, dlvl, level_type), + false, true).c_str())); } if (verbose && death_type != KILLED_BY_QUITTING) @@ -2122,10 +2121,9 @@ void xlog_fields::add_field(const std::string &key, const char *format, ...) { - char buf[500]; va_list args; va_start(args, format); - vsnprintf(buf, sizeof buf, format, args); + std::string buf = make_stringf(format, args); va_end(args); fields.push_back( std::pair<std::string, std::string>( key, buf ) ); |