[Scummvm-cvs-logs] CVS: residual TODO,1.1.1.1,1.2 textsplit.cpp,1.1,1.2
James Brown
ender at users.sourceforge.net
Fri Aug 15 14:00:05 CEST 2003
Update of /cvsroot/scummvm/residual
In directory sc8-pr-cvs1:/tmp/cvs-serv1442
Modified Files:
TODO textsplit.cpp
Log Message:
Ultrahacky vsscanf implementation for Win32, etc
Index: TODO
===================================================================
RCS file: /cvsroot/scummvm/residual/TODO,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -u -d -r1.1.1.1 -r1.2
--- TODO 15 Aug 2003 18:00:28 -0000 1.1.1.1
+++ TODO 15 Aug 2003 20:39:55 -0000 1.2
@@ -9,6 +9,7 @@
* Check sound decoder - it clips.. possible uint vs int casting issue, perhaps?
* Add OpenGL lighting
* Add SMUSH (aquadran is looking, Grim seems to uses CMI codecs + 2 new ones)
+ * Proper vsscanf implementation in textsplit.cpp for platforms without it (many!)
MSVC notes:
These things need doing (At least) for it to be compilable under MSVC..
Index: textsplit.cpp
===================================================================
RCS file: /cvsroot/scummvm/residual/textsplit.cpp,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -d -r1.1 -r1.2
--- textsplit.cpp 15 Aug 2003 19:41:26 -0000 1.1
+++ textsplit.cpp 15 Aug 2003 20:39:55 -0000 1.2
@@ -22,6 +22,26 @@
#include <cctype>
#include <cstdarg>
+
+// FIXME: Replace this with a proper parser (this is just too dodgy :)
+int residual_vsscanf(const char *str, int field_count, const char *format, va_list ap) {
+ unsigned int f01 = va_arg(ap, long);
+ unsigned int f02 = va_arg(ap, long);
+ unsigned int f03 = va_arg(ap, long);
+ unsigned int f04 = va_arg(ap, long);
+ unsigned int f05 = va_arg(ap, long);
+ unsigned int f06 = va_arg(ap, long);
+ unsigned int f07 = va_arg(ap, long);
+ unsigned int f08 = va_arg(ap, long);
+ unsigned int f09 = va_arg(ap, long);
+ unsigned int f10 = va_arg(ap, long);
+
+ if (field_count > 10)
+ error("Too many fields requested of residual_vsscanf (%d)", field_count);
+
+ return sscanf(str, format, f01, f02, f03, f04, f05, f06, f07, f08, f09, f10);
+}
+
TextSplitter::TextSplitter(const char *data, int len) {
data_ = new char[len + 1];
std::memcpy(data_, data, len);
@@ -45,7 +65,12 @@
std::va_list va;
va_start(va, field_count);
+
+ #ifdef WIN32
+ if (residual_vsscanf(currentLine(), field_count, fmt, va) < field_count)
+ #else
if (std::vsscanf(currentLine(), fmt, va) < field_count)
+ #endif
error("Expected line of format `%s', got `%s'\n", fmt, currentLine());
va_end(va);
More information about the Scummvm-git-logs
mailing list