[Scummvm-cvs-logs] SF.net SVN: scummvm:[49303] tools/branches/gsoc2010-decompiler/decompiler/ disassembler.cpp
pidgeot at users.sourceforge.net
pidgeot at users.sourceforge.net
Sat May 29 00:17:24 CEST 2010
Revision: 49303
http://scummvm.svn.sourceforge.net/scummvm/?rev=49303&view=rev
Author: pidgeot
Date: 2010-05-28 22:17:24 +0000 (Fri, 28 May 2010)
Log Message:
-----------
Replace sprintf in Disassembler::dumpDisassembly with Boost.Format
Modified Paths:
--------------
tools/branches/gsoc2010-decompiler/decompiler/disassembler.cpp
Modified: tools/branches/gsoc2010-decompiler/decompiler/disassembler.cpp
===================================================================
--- tools/branches/gsoc2010-decompiler/decompiler/disassembler.cpp 2010-05-28 22:04:09 UTC (rev 49302)
+++ tools/branches/gsoc2010-decompiler/decompiler/disassembler.cpp 2010-05-28 22:17:24 UTC (rev 49303)
@@ -20,6 +20,8 @@
*
*/
+#include <boost/format.hpp>
+
#include "disassembler.h"
Disassembler::Disassembler() {
@@ -31,41 +33,37 @@
}
void Disassembler::dumpDisassembly(std::ostream &output) {
- char buf[1024];
- int length;
-
for (size_t i = 0; i < _insts.size(); i++) {
Instruction inst = _insts[i];
- length = sprintf(buf, "%08x: %s ", inst._address, inst._name.c_str());
+ output << boost::format("%08x: %s ") % inst._address % inst._name;
for (size_t j = 0; j < inst._params.size(); j++) {
Parameter p = inst._params[j];
if (j != 0)
- length += sprintf(&buf[length], ", ");
+ output << ", ";
switch(p._type) {
case kSByte:
- length += sprintf(&buf[length], "%d", p._sbyte);
+ output << p._sbyte;
break;
case kByte:
- length += sprintf(&buf[length], "%u", p._byte);
+ output << p._byte;
break;
case kShort:
- length += sprintf(&buf[length], "%d", p._short);
+ output << p._short;
break;
case kUShort:
- length += sprintf(&buf[length], "%u", p._ushort);
+ output << p._ushort;
break;
case kInt:
- length += sprintf(&buf[length], "%d", p._int);
+ output << p._int;
break;
case kUInt:
- length += sprintf(&buf[length], "%u", p._uint);
+ output << p._uint;
break;
case kFloat:
- length += sprintf(&buf[length], "%f", p._float);
+ output << p._float;
break;
}
}
- length += sprintf(&buf[length], "\n");
- output << buf;
+ output << "\n";
}
}
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