[Scummvm-cvs-logs] SF.net SVN: scummvm:[51030] scummvm/branches/gsoc2010-testbed/engines/ testbed
sud03r at users.sourceforge.net
sud03r at users.sourceforge.net
Mon Jul 19 16:54:26 CEST 2010
Revision: 51030
http://scummvm.svn.sourceforge.net/scummvm/?rev=51030&view=rev
Author: sud03r
Date: 2010-07-19 14:54:25 +0000 (Mon, 19 Jul 2010)
Log Message:
-----------
replaced use of snprintf by String::printf
Modified Paths:
--------------
scummvm/branches/gsoc2010-testbed/engines/testbed/graphics.cpp
scummvm/branches/gsoc2010-testbed/engines/testbed/misc.cpp
scummvm/branches/gsoc2010-testbed/engines/testbed/misc.h
Modified: scummvm/branches/gsoc2010-testbed/engines/testbed/graphics.cpp
===================================================================
--- scummvm/branches/gsoc2010-testbed/engines/testbed/graphics.cpp 2010-07-19 14:50:37 UTC (rev 51029)
+++ scummvm/branches/gsoc2010-testbed/engines/testbed/graphics.cpp 2010-07-19 14:54:25 UTC (rev 51030)
@@ -918,9 +918,9 @@
colors[5] = iter->RGBToColor(47, 78, 36);
Common::Point pt(0, 170);
- char msg[100];
+ Common::String msg;
// XXX: Can use snprintf?
- snprintf(msg, sizeof(msg), "Testing Pixel Formats, %d of %d", numFormatsTested, pfList.size());
+ msg = Common::String::printf("Testing Pixel Formats, %d of %d", numFormatsTested, pfList.size());
Testsuite::writeOnScreen(msg, pt, true);
// CopyRectToScreen could have been used, but that may involve writing code which
Modified: scummvm/branches/gsoc2010-testbed/engines/testbed/misc.cpp
===================================================================
--- scummvm/branches/gsoc2010-testbed/engines/testbed/misc.cpp 2010-07-19 14:50:37 UTC (rev 51029)
+++ scummvm/branches/gsoc2010-testbed/engines/testbed/misc.cpp 2010-07-19 14:54:25 UTC (rev 51030)
@@ -27,12 +27,8 @@
namespace Testbed {
-void MiscTests::getHumanReadableFormat(TimeDate &td, Common::String &date) {
- // XXX: can use snprintf?
- char strDate[100];
- snprintf(strDate, 100, "%d:%d:%d on %d/%d/%d (dd/mm/yy)", td.tm_hour, td.tm_min, td.tm_sec, td.tm_mday, td.tm_mon, td.tm_year + 1900);
- date = strDate;
- return;
+Common::String MiscTests::getHumanReadableFormat(TimeDate &td) {
+ return Common::String::printf("%d:%d:%d on %d/%d/%d (dd/mm/yyyy)", td.tm_hour, td.tm_min, td.tm_sec, td.tm_mday, td.tm_mon + 1, td.tm_year + 1900);
}
void MiscTests::timerCallback(void *arg) {
@@ -75,7 +71,7 @@
g_system->getTimeAndDate(t1);
Testsuite::logDetailedPrintf("Current Time and Date: ");
Common::String dateTimeNow;
- getHumanReadableFormat(t1, dateTimeNow);
+ dateTimeNow = getHumanReadableFormat(t1);
if (Testsuite::isSessionInteractive) {
// Directly verify date
@@ -87,13 +83,13 @@
}
g_system->getTimeAndDate(t1);
- getHumanReadableFormat(t1, dateTimeNow);
+ dateTimeNow = getHumanReadableFormat(t1);
Testsuite::logDetailedPrintf("%s\n", dateTimeNow.c_str());
// Now, Put some delay
g_system->delayMillis(2000);
g_system->getTimeAndDate(t2);
Testsuite::logDetailedPrintf("Time and Date 2s later: ");
- getHumanReadableFormat(t2, dateTimeNow);
+ dateTimeNow = getHumanReadableFormat(t2);
Testsuite::logDetailedPrintf("%s\n", dateTimeNow.c_str());
if (t1.tm_year == t2.tm_year && t1.tm_mon == t2.tm_mon && t1.tm_mday == t2.tm_mday) {
Modified: scummvm/branches/gsoc2010-testbed/engines/testbed/misc.h
===================================================================
--- scummvm/branches/gsoc2010-testbed/engines/testbed/misc.h 2010-07-19 14:50:37 UTC (rev 51029)
+++ scummvm/branches/gsoc2010-testbed/engines/testbed/misc.h 2010-07-19 14:54:25 UTC (rev 51030)
@@ -43,7 +43,7 @@
// Miscellaneous tests include testing datetime, timers and mutexes
// Helper functions for Misc tests
-void getHumanReadableFormat(TimeDate &td, Common::String &date);
+Common::String getHumanReadableFormat(TimeDate &td);
void timerCallback(void *arg);
void criticalSection(void *arg);
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
More information about the Scummvm-git-logs
mailing list